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"

learn more… | top users | synonyms

31
votes
6answers
9k views

What are the pros and cons of HLSL vs GLSL vs cg? [closed]

What are the pros / cons of the three?
5
votes
2answers
986 views

OpenGL equivalent of .fx files in GLSL or Cg?

There's a lot of learning material in the DirectX world that uses .fx files to manage shaders, and .fx seems to be well integrated with 3D packages such as Maya and 3D Studio Max What do larger ...
4
votes
1answer
702 views

Custom shadow mapping in Unity 3D Free Edition

Since real time hard and soft shadows are Unity 3D Pro only features I thought I will learn Cg programming and create my own shadow mapping shader. But after some digging I found that the shadow ...
2
votes
1answer
486 views

Shader optimization - Cg/HLSL pseudo and via multiplication

HLSL/Cg do not allow texture fetching inside conditional blocks. To get around this I am first checking a variable and performing some computations, afterwards I set a float flag to 0.0 or 1.0, ...
2
votes
1answer
263 views

shader coding: calculate screen coordinates of fragment

Good morning, I'm new to shader coding and trying to implement some visual effects code in shaders using billboards. (Yes, I couldn't have picked anything harder to start with, but I'm lucky that way) ...
2
votes
1answer
752 views

Unity custom shaders and z-fighting

I've just readed a chapter of Unity iOS Essential by Robert Wiebe. It shows a solution for handling z-figthing problem occuring while rendering a street on a plane with the same y offset. Basically ...
2
votes
1answer
466 views

Doubt about texture waves in CG Ocean Shader

I'm new on graphical programming, and I'm having some trouble understanding the Ocean Shader described on "Effective Water Simulation from Physical Models" from GPU Gems. The source code associated to ...
2
votes
0answers
199 views

Kinect User Silhouette Shader

I have this usermap from kinect's depth data (size is 320x280) and i want to display it on my game. The problem, of course it's ugly (first image) and i want to have beautiful effect like in the ...
1
vote
1answer
119 views

My game works on the emulator and the PSVita, but crashes on Android

I made a game on PSM, ported from a previous iOS/Android game. I test it on the emulator and PSVita and runs fine. However, as I test it on a PlayStation Certified Android device, it crashes on load. ...
1
vote
1answer
478 views

What kind of shader is this?

Cube World uses a pretty good looking shader, I especially like the shading of the characters: Is this soft shading? I'd like to achieve this effect in Unity 3D Free, but since the free version ...
1
vote
0answers
109 views

Correct order of operations when enabling/disabling Cg shaders in OpenG

I've started writing an Effect class which uses Cg shaders in OpenGL and I'm a bit confused about the order of operations when creating and rendering using Cg. Currently, my Effect class contains ...
0
votes
1answer
436 views

Nvidia Cg 3.0 Manual/Documentation?

I can only find a user's manual for Cg 1.4 from Sept 2005, and the Cg Tutorial from earlier than that. Cg is now on version 3 and I'm wondering about all the new profiles and tech that must be in ...
0
votes
1answer
202 views

Calculating distance from viewer to object in a shader

Good morning, I'm working through creating the spherical billboards technique outlined in this paper. I'm trying to create a shader that calculates the distance from the camera to all objects in the ...
0
votes
1answer
512 views

CG/CGFX to GLSL

So, I'm making the painful move from my beloved XNA to OpenTK, and I'm stuck: Since I've got a LOT of existing shaders written in HLSL, NVidia's CG compiler seems like a natural way to minimize the ...
0
votes
1answer
315 views

Custom made depth bias (vertex) shader

As most of intermediate graphics programmers know, z-fighting can be a problem. That's why most game engines prevent this from happening by using a slope depth bias algorithm. As there's no direct ...
0
votes
0answers
37 views

Unity Shader GrabPass alternative

Is there an alternative for the heavy GrabPass method ? Is there a solution to avoid the foreground issue ? I mean when using GrabPass, if the refracted object is in front of the bumpy refractor, he ...
0
votes
1answer
153 views

How to do Triplanar Texturing

Ok maybe i'm missing something because its getting late and i've been programming now for about 72 hours straight (minus a nap or 2) ... I'm trying to write a shader for unity that will apply ...
0
votes
0answers
49 views

NVIDIA FX Composer 2.5 not updating time in preview

I started testing shaders today and got a problem with FX Composer. When I download Shaders from the Shader Library it compiles them fine and I get a preview which applies the material to the object, ...
0
votes
0answers
81 views

How to move a directional light according to the camera movement?

Given a light direction, how can I move it according to the camera movement, in a shader? Think that an artist has setup a scene (e.g., in 3DSMax) with a mesh in center of that and a directional ...
0
votes
0answers
210 views

Differences in cg shader code for OpenGL vs. for DirectX?

I have been trying to use an existing library that automatically generates shaders (Hydrax plugin for Ogre3D). These shaders are used to render water and somewhat involved, but are not extremely ...
-1
votes
1answer
202 views

New to CG shader programming, what program should I use to write and test them? [closed]

I have started witting some shaders. First ones were fairly easy to write in notepad but now I need something with a bit more meat. I have checked rendermonnkey that seems to support CG but it is ...