Tag Info

Hot answers tagged

18

That's the gist of it. In principle, the platform could, conceivably, do whatever it wants. One could imagine an advanced operating system doing just-in-time translation of compiled code from, say, x86 to GPU code. Similarly, OpenGL drivers could run whatever it wants on the host CPU. But really, what you just described, is what happens.


9

I tried to implement what teodron suggested: void main() { vec2 uv = gl_FragCoord.xy / resolution.xy; float sepoffset = 0.005*cos(iGlobalTime*3.0); if (uv.y > 0.3 + sepoffset)// is air - no reflection or effect { gl_FragColor = texture2D(texture, vec2(uv.x, -uv.y)); } else { // Compute the mirror effect. ...


6

Generally, Yes. Java is used to write programs that run on the cpu. Shader languages (cg,hlsl, et al) are used to write programs that run on the gpu. An exception to the rule would be using third party apis which can bridge the gap.


5

Sarting with the clouds, a simple method is to draw them as three layers: Layer 1 is the bottom layer, and is drawn first. It just contains the cyan background. Layer 2 is the middle layer, drawn between the other two, and it represents the 3D highlights. The background in this layer would again be transparent (represented by a purple colour in the ...


3

You could achieve this effect using parallax scrolling by making the earth and each shade of green a separate layer. With a parallax effect, no 3D calculations are required, and you get to stay with the pixelated, simple color style you're using. Note that parallax doesn't have to be limited to just horizontal motion. Vertical movement (when the camera ...


2

The .fxo files are compiled shader files. Think of .obj/.o files for C and C++, but for HLSL. They're the result of running the shader compiler fxc.exe over your shader files. The advantages of .fxo files are three fold. First, the make reverse engineering of your shader code a bit more difficult, which is advantageous for some of the higher-end games with ...


2

david van brink answered your question in general. But like he says, OpenGL driver could run stuff on the CPU, and it actually happens a lot. Especially with compatibility contexts, where some weird legacy functions cannot be implemented on the graphic cards. They require software emulation. For example, I've heard before that stippling is executed on the ...


2

Make sure you right click -> properties on each shader file and set the Shader Type as well. The property right above the shader model in your graphic.


2

The problem is likely VS is trying to compile your Include.hlsl file which doesn't actually contain any functions. Use Include.hlsli instead.


1

Found! (Thank you Frame Debugger !) It turns out that Unity renders the Depth Texture in a separate pass before all geometry is rendered. It is hard to find how to include objects in this pass, and how to specify how they are drawn. The documentation is kind of vague, but it tells you that the "RenderType" is important without specifying what it should ...


1

The "tint" color is a color that gets modulated (multiplied) with the texture color. This color is used with sprites for effects like making the player sprite blink red when hit by an enemy. To do so, you could set the tint to red when the player gets hit and leave it red for a couple frames, them restore it to white. Do that repeatedly for a few seconds and ...


1

What makes you think this is the shader code that is slow ? In most machines nowadays, and especially mobile devices, the bottlenecks are not these purely calculation-fed (ALU loaded) shaders, but memory bandwidth. Memory bandwidth is used by framebuffers being fed to shaders as textures, or by the ROPs writing to the render target. Especially bad when ...


1

To fix these kinds of issues create a test cubemap clearly marking each face directions and +/- XYZ you can then figure out which one(s) is(are) pointing the wrong way.


1

If you use a point sampler for your mask texture, then you can store as many IDs as bits in your texture: for a 32-bit RGBA texture you'd be able to store 128 different IDs. In such a case though, as you have a single bit per ID, there's virtually no blending as you have only 0 or 1. The more bits you devote per ID, the greater the blending granularity, ...


1

It is technically possible with OpenGL ES 2 but almost no device currently support it. You'll have to check GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS on devices. For small "textures" you can use a small array of uniforms. A lot of (old) desktop video cards still in use only supports GL_LUMINANCE32F_ARB and GL_RGBA32F_ARB or don't support any VTF at all. If you ...



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