Questions tagged [cg]
CG is a programming language for 3D graphics that runs on the GPU. It was designed by NVIDIA and Microsoft. It stands for "C for graphics"
64 questions
0 votes
0 answers
36 views
How to do DOF & motion blur using 1 image & depth?
Is there any way to do DOF & motion blur based on just 1 image & its depth image on a mobile platform?
0 votes
0 answers
413 views
How to calculate the world position of pixels in an HLSL script?
I want to make a simple ray marching loop in the fragment shader. I think the main issue is that I'm not giving the correct world position input. Here is my current attempt: ...
4 votes
1 answer
4k views
How to write shaders that can be compiled for DirectX, OpenGL, and Vulkan
I recently finished writing the DirectX renderer for my game engine. Now I have an OpenGL, DirectX as well as a not yet finished Vulkan renderer. Well, the majority of the renderers work perfectly now ...
1 vote
0 answers
852 views
Blinking color shader
Currently i'm using Unity3D, and i want to make one variable blink along time in a fragment shader. Now i have code like this: ...
0 votes
2 answers
373 views
GPU Gems Chapter 1, update normal
Had plans to follow GPU Gems to gain knowledge in Shaders - but my journey came to an abrupt end. ...
1 vote
1 answer
3k views
Surface Depth Intersection Shader
I recently asked a question about the creating an accurate Depth Intersection Shader. When creating this in a fragment / vertex shader it could be achieved by the following code ...
0 votes
1 answer
2k views
What does declaring a const float within a function do? (CGFX)
I've been working with this piece of code to get the mip map level that I should sample for a texture that I got off a forum somewhere. I noticed that they use a const float. Now from what I ...
1 vote
1 answer
4k views
Modifying Alpha in Unity Standard Shader
I'm trying to create a shader in Unity with a slider that can adjust the transparency. (This is the first step toward something more sophisticated.) I try to do this by setting the alpha of the ...