Tag Info

Hot answers tagged

9

I don't know of any plug and play solutions for it, but here is an algorithm that works in the pixel shader with just a texture as extra assets. The asset required is a small texture with a single row of some number of tiles, where the left most is the darkest and the right most the lightest. What happens then is (per frame): Take the buffer you want to ...


6

I'll try to answer to the best of my knowledge, with little knowledge about the specific case of UE4, but rather on the general technique. Graph based materials are as much programming as writing the code yourself. It just doesn't feel like it for people with no background on code, making it seemingly easier. So, when a designer links a "Add" node, he is ...


5

You can reduce the instruction count by using vector operations: e.g. instead of edr = bool4((w1.x < w2.x) && ir_lv1.x, (w1.y < w2.y) && ir_lv1.y, (w1.z < w2.z) && ir_lv1.z, (w1.w < w2.w) && ir_lv1.w); you can write edr = (w1 < w2) && ir_lv1; Operators in HLSL ...


5

I got this working. It does not use the hqx filter, it uses the xBR filter (which I prefer). For me, this is not a problem. If you require the hqx filter then you'll want to convert the .cg files into their appropriate XNA equivalent. For completeness and searching reasons, I will be editing the question to be more concise and then posting all the relevant ...


4

For best performance you should avoid changing uniforms as well as shaders by using vertex attributes. Ideally pack all your 2D object textures into 1 single large texture (called an atlas) so you can render all your 2D objects in one call using a single vertex buffer. In your large texture you also put a 4x4 white area and map the texture coordinates of ...


4

Khronos provides a reference GLSL compiler. It is capable of validating GLSL up to version 3.50 (full support) and up to 4.50 (partial support). It also handles ESSL (OpenGL ES's GLSL). The tool verifies that the shader conforms to the GLSL specification. This does not necessarily guarantee that it works with all drivers but it does guarantee that the ...


2

Bloom effect filters are usually circularly symmetric or isotropic. You can't achieve your goal by solely modifying the radial shape of the filter, since it won't break the symmetry. However, to implement the desired effect, you can use e. g. the stencil buffer to mask out the region you want to remain dark. Alternatively you can create a texture of the ...


2

Simple lens shader that uses object's normals to distort the background. Render texture without this object, use it as "ScreenMapSampler" and then render all scene including this object in final frame. Not best implementation, but it works. struct PS_OUTPUT{float4 Color : COLOR0;}; struct VS_Lens { float4 Position: POSITION; float4 ...


2

Rather than using a geometry shader as mentioned in another answer, I managed to implement the lines very cleanly in the fragment shader, by passing the spherical coordinates before the deformation from the tessellation shader to the fragment shader. There I could then use uniforms that describe the number of level curves to calculate position and line width ...


1

World position is vertex position multiplied by world matrix, not view matrix. So it should be like this in the vertex shader: output.WorldPos = mul(input.Pos,World); Unless you want View position to work with. I haven't checked the code for bugs if you want to use that.


1

You can use a geometry shader to generate those lines. There are a few tutorials/examples on how to generate sprites with geometry shaders, you can base yourself off of these to create thick lines with triangle strips from line strips. http://www.geeks3d.com/20140815/particle-billboarding-with-the-geometry-shader-glsl/


1

Here's how I've approached this situation in Unity in the past: I create a custom shield shader that accepts some number of vector parameters (typically 3 or 4), each representing a recent hit. The xyz components are the position of the hit in local coordinates, and the w component is the intensity. Within the fragment shader, I compute the object-space ...


1

The reason is due to a bug in the driver (or an overlooked gotcha in the GLSL language?). Your vertex shader uses some of the struct members, your fragment shader uses a different set of the struct members, and the drivers ends up creating 2 different types by independently eliminating the unused uniforms from the struct type in both shaders which cause them ...


1

Because the plane in front is alpha-blended over the entire screen, after all the alpha leaves behind it have been drawn as objects they are depth-sorted by Unity to render properly with alpha-blending. In your test without the front plane the cost of blending is minimal as all of the leaves use the same shader and texture which are in the cache and only ...


1

You could use compressed textures to store your 1bpp image, they can all store 1bpp images without loss as each tiles can have 2 colors (and in-betweens). PVRTC supports a 2bpp format, PVRTC is only supported on PowerVR devices. ETC1 and S3TC (DXT1) are 4bpp which comes back to the same size as 4x4 in RGBA4444 format but you don't need to combine and then ...



Only top voted, non community-wiki answers of a minimum length are eligible