Cg is a high-level shading language developed by Nvidia.
Questions tagged [cg]
300 questions
2
votes
2 answers
How to modify/displace pixel position in a Cg fragment shader?
Is it possible to modify pixel coordinates in a fragment (pixel) shader using Cg? I'm sure such functionality became available in 2nd/3rd-generation shaders but I don't know what profiles exactly, or how to do it.

Mr. Boy
- 60,845
- 93
- 320
- 589
2
votes
1 answer
Where can I find a reference of the CG shader language?
I am new to shaders and I would like to find a list of all (or most/common) functions, variables, availeble to write CG shaders.

Aaron de Windt
- 16,794
- 13
- 47
- 62
2
votes
1 answer
Sprite outline effect appears one frame later
So, I have the following problem in a Unity 2019.4.36f1 fresh project.
I would like to outline group of sprites with the Built-in render pipeline. For this, the developer needs to collect the SpriteRenderers it would like to group together. Then the…

Menyus
- 6,633
- 4
- 16
- 36
2
votes
1 answer
CG Shader Semantics with OpenGL 3.x?
I used to have CG shaders working with vertex arrays in OpenGL 2.x, but I've updated to use VBOs and VAOs in OpenGL 3.x and now the semantics don't seem to be working, except for POSITION. CG doesn't throw up any compile errors, but if I set my…

Apostate
- 247
- 1
- 4
- 10
2
votes
0 answers
Where can I find the source code for NVIDIA's Cg toolkit?
NVIDIA's Cg toolkit is a dependency for a project I'm attempting to compile, and only has ppc and x86_64 architectures on macOS. As of now, I'm currently trying to compile the software for x86_64 and arm64 to troubleshoot issues between the correct…

Meh.
- 234
- 2
- 12
2
votes
2 answers
Is ModelViewProjection the same as WorldViewProjection?
I am converting some code from HSLSL and XNA to CG and OpenGL.
The code is for rendering volume data. But volume data is not also sampled using the same distance in each dimension, for example (0.9f, 1f, 1f). So a scale factor need to be applied.
In…

Benzino
- 577
- 2
- 8
- 21
2
votes
2 answers
Iphone working with images stops all processes
Hello I am new to iPhone development so I could be doing this all wrong. I want to convert an image 3 times in a row but when I do it locks up the iphone until it finishes all 3 conversions. I have functions between the steps but they will not fire…

Kunadiso
- 71
- 1
- 4
2
votes
1 answer
What is the exact difference between the camera transformation matrix and the view matrix (using OpenGL and lwjgl)
I've read a lot online before asking this question, and I came to understand that the View matrix is just the inverse of the Camera Transformation matrix. For the sake of clarity, if we treat the Camera as an actual entity that is transformed like…

Davide Pasero
- 85
- 9
2
votes
1 answer
How do I get a Compile error from NVIDIA CG?
How do I get detailed errors from a cg compile?
At the moment my code is something like:
prog = cgCreateProgramFromFile(
context,
CG_SOURCE,
filename,
proifile,
null,null);
std::cout << cgGetErrorString(cgGetError());
But all I…

DaedalusFall
- 8,335
- 6
- 30
- 43
2
votes
2 answers
Unity particle outline shader
I wish to create an unlit shader for a particle system that emits cube meshes, such that each emitted mesh has a hard black outline around it.
Here is the pass for the outline (in Cg):
struct appdata {
float4 vertex : POSITION;
float3 normal…

rbjacob
- 193
- 3
- 14
2
votes
1 answer
How to make 3d object visible behind wall, but invisible if behind wall and under ground
I'd like to start off by saying that my shader coding knowledge is pretty limited. I know the basics and I can eventually understand how a shader works, but that's about it.
Please have a look at the following image:
I have 4 objects in the scene…

stefanplc
- 419
- 9
- 22
2
votes
0 answers
Can't load Cg shaders when RenderDoc is attached in OpenGL
I'm trying to debug my OpenGL game using RenderDoc, but if I launch from RenderDoc, then no graphics are shown and Cg outputs errors on startup. How can I get RenderDoc to work with my game?
I get a couple of…

Oogst
- 358
- 2
- 14
2
votes
2 answers
Correct "Semantic" tag on a shader for just a float3?
Here's a very simple shader,
float4 vert (float4 vertex :POSITION, out PositionHolder o) :SV_POSITION
{
UNITY_INITIALIZE_OUTPUT(PositionHolder,o);
o.localPos = vertex;
return UnityObjectToClipPos(vertex);
}
fixed4 frag (PositionHolder…

Fattie
- 27,874
- 70
- 431
- 719
2
votes
1 answer
Simply get the scaling of an object inside the Cg shader
Say you have a trivial Unity shader. It does not at all use any texture. It grabs simply the position ..
void vert (inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input,o);
o.localPos = v.vertex.xyz;
}
and then draws a…

Fattie
- 27,874
- 70
- 431
- 719
2
votes
1 answer
Multiple SubShaders, only one is rendering
I am trying to add multiple sub shaders to one shader. One SubShader is just the standard Unity surface shader, and the second SubShader is a transparent outline that I have modified from somewhere I found online. Here is the code that I have so…

BenjaFriend
- 664
- 3
- 13
- 29