Questions tagged [cg]

Cg is a high-level shading language developed by Nvidia.

300 questions
0
votes
0 answers

Gamma Space and Linear Space with Shader

I am using Unity and I can choose between two color space mode in the settings: Gamma or Linear Space. I am trying to build a Custom Lighting Surface shader but I am facing some problems with those Color Space. Because the render is not the same…
MaT
  • 1,556
  • 3
  • 28
  • 64
0
votes
1 answer

Is it possible to test textures in glsl or cg?

I am trying to see if my texture coming in to my shader. I am have the following code so far but I need to know if my texture is coming in to my fragment shader or not. Is it even possible to test that? Thanks for the answers already sampler2D…
0
votes
1 answer

Drawing circular splats from vertex position

I want to draw circular splats, however my only data is the vertex position. So I draw the points in C++ and they appear at the right position. My point size is set to 20pixels, thus the points are big enough to discard some pixels to get a…
Aloys
  • 682
  • 4
  • 11
0
votes
1 answer

Transparency shader cover model

I am using XNA, implementing the HLSL shader and i have a problem with transparency in the shader; When rendering two models and they are facing each other the model behind is seen only when it is first rendered Let me explain... blue cone =…
0
votes
2 answers

Mixing up Cg and GLSL shaders

I've just got an old OpenGL(2.1)/Cg(3.1) code, which I should improve, particularly a deferred shading rendering , where I want to change the kernel of one of the passes. I'm adding GLSL(3.30) As I'm much more habituated. It seems to work, but I'm…
0
votes
1 answer

Matrices orthongonality and getting values from shaders

My first question is that , is the _Object2World Matrix Orthogonal ? I mean , is the inverse transpose of _Object2World is equal to _Object2World Matrix ? : _Object2World = Inverse Transpose (_Object2World ) //is orthogonal ? Because I had test…
S.A.Parkhid
  • 2,772
  • 6
  • 28
  • 58
0
votes
1 answer

How many arithmetic instructions are too many?

Currently I am trying to make some shader textures for a game and I am using perlin noise to do so, each time I get a noise value, it adds about 730 instructions to the shader, how many instructions should i aim for? What video cards would support…
Guedez
  • 189
  • 3
  • 14
0
votes
1 answer

cg: Vertex output struct corrupted by different member order? Profile violation or cg bug?

I've been tinkering with cg shaders for Retroarch, and I've encountered what appears to be a strange bug in the Cg Toolkit's compiler or code generator...or something. Consider the three-pass shader found here which simulates a CRT TV:…
Mike S
  • 531
  • 4
  • 14
0
votes
1 answer

What's wrong with my BRDF programm in CG

Now I'm working on a basic CG program about the BRDF. And after I got the image, it seems that, all the points face to the light is too bright, I don't know the reason. And here's my code, where I tried to invoke the lookup_brdf_val function. Vec3f…
Cong Wang
  • 769
  • 1
  • 9
  • 30
0
votes
1 answer

how to call a function defined in another cg shader file

If i define a function in a cg shader file and I want to call it in another cg shader file. Can I do this just like glsl? If I can implement it in this way, then how to implement?
Cheery
  • 45
  • 6
0
votes
1 answer

CG float4 maths 4 times slower than float maths?

I wrote 20 fragment maths operations on a variable called half H. Then i ran 5 similar maths instructions for a half4 XYZH.... the second shader was very considerably slower!!! I was completely surprised, it seems more than 4 times slower!!! i am…
bandybabboon
  • 2,210
  • 1
  • 23
  • 33
0
votes
1 answer

When I don't access one of my textures, the other texture lookup appears black

I have the following CG pixel shader: float4 main( float2 texCoord : TEXCOORD0, float4 position : TEXCOORD2, float4 color : COLOR, uniform sampler2D texture_sample : TEX1, uniform sampler2D stipple_sample : TEX2, uniform…
0
votes
2 answers

how to implement catmull interpolation in unity CG

I'm working on a CG shader which will do a limited amount of vertex animation (or 'morphing') on low end hardware. I'll be packing animation frames into extra texcoords (the limited resolution is acceptable for what I need to do ) and…
theodox
  • 12,028
  • 3
  • 23
  • 36
0
votes
1 answer

Using Auto Layout with CGContext drawing methods?

I have an existing iPad app (XCode 4.6, ARC, Storyboards and iOS 6.2). The app works perfectly in Portrait mode, but not so well in Landscape mode using Auto Layout (see images below). The image above shows portrait mode, which is correct. This…
SpokaneDude
  • 4,856
  • 13
  • 64
  • 120
0
votes
1 answer

What's happens on default fragment shader in CG shader language?

I have code on CG. In this code vertex shader emit 3 parameters: vertex position (float4), texture coordinates (float2) and color (float4). But fragment program not defined. How shader use this 2 parameters (uv and color) on fragment shader?
toodef
  • 125
  • 1
  • 11