Questions tagged [cg]

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

300 questions
2
votes
3 answers

color ramp shader (cg / shaderlab)

I have a shader function which functions like the "color ramp" node in Blender3D. It takes as input a float between zero and one and outputs a color that is a blend of any number of colors in a specified order: blender3D color ramp Here is my…
dixiepig
  • 123
  • 1
  • 4
2
votes
1 answer

Unity custom skybox like Unity skybox

I'm trying to do a custom skybox for 360 images which has 2 textures with a crossfade and I need it to respond to Rotation value like the Unity Skybox. I just need the same slider but I´m not getting any luck, I'm complete new on shaders. Here is…
2
votes
1 answer

OpenGL spotlight with Cg

I'm trying to accomplish a spotlight effect with Cg. I've already managed to do normal ambient and diffuse lighting. I understand the basic functionality of a spotlight (position, direction, cutoff angle), yet handling these in Cg still eludes…
adivasile
  • 2,377
  • 3
  • 24
  • 32
2
votes
1 answer

OpenGL lighting with Cg

I'm already familiar with OpenGL's native lights. My question is how do I go about rendering lights with Cg? Do I still need to declare normal OpenGL lights and then use Cg to render the light?Or is it all done with Cg? If you could point me to some…
adivasile
  • 2,377
  • 3
  • 24
  • 32
2
votes
1 answer

Embedding other language in Flex/Bison

The bottom line: If you would like to add one, very small feature into C++ using Flex/Bison, how would you do that? For example, ability to declare void xxx() functions with syntax: foo%%: xxx? The whole story: Once I have coded a custom shader…
programmer
  • 21
  • 1
2
votes
1 answer

Shader and opengl transformations

When i add shaders (in cg) to my opengl program all the local transformations (glRotatef, glTranslatef and glScalef between glPushMatrix and glPopMatrix) stop working. Transforms outside push/pop still working though. So what might be the problem…
spacevillain
  • 1,336
  • 1
  • 14
  • 25
2
votes
1 answer

Perlin Noise: Why Would 2nd Order Interpolant Derivative Create Normal/Shading Artefact?

I am studying/implementing a version of the Perlin Noise and Improved Perlin Noise. Perlin says in his paper that he replaced the smoothstep function 3t^2 - 2t^3 that he used to interpolate the 8 linear functions at the grid cell's corners with the…
user18490
  • 3,546
  • 4
  • 33
  • 52
2
votes
1 answer

gl_MultiTexCoord in HLSL/CG?

I cam currently trying to convert a GLSL shader into a CG shader for Unity. I am an absolute beginner regarding shaders, so please bear with me. While doing so, I encountered the following in the GLSL shader: oBentNormal = gl_MultiTexCoord7; From…
user2655904
2
votes
1 answer

Cg and OpenGL 3

I'm currently learning the differences between OpenGL 2 and 3, and I noticed that many functions like glVertex, glVertexPointer, glColor, glColorPointer, etc. have disappeared. I'm used to using Cg to handle shaders. For example I'd write this…
Tomaka17
  • 4,832
  • 5
  • 29
  • 38
2
votes
2 answers

Unity/CG: Scale object in vertex shader

I'm trying to write a vertex shader that scales the size of the object. I've found many "solutions" to this problem, all to the tune of "expanding vertices along the normals" like so: v2f vert(appdata_base v) { v2f OUT; float3 norm =…
Valevalorin
  • 390
  • 1
  • 3
  • 18
2
votes
1 answer

Using SharpDX 2.6.3 under Windows 10

I recently updated my machine from Windows 8 to Windows 10. Since then, I get a NullReferenceException in SharpDX.Toolkit.Game.dll when I call this.game.Run(context) Where game inherits from SharpDX.Toolkit.Game and context is a…
Michael Hilus
  • 1,647
  • 2
  • 21
  • 42
2
votes
1 answer

Vertex to Pixel Shader TEXCOORD interpolation precision issues

I think I'm experiencing precision issues in the pixel shader when reading the texcoords that's been interpolated from the vertex shader. My scene constists of some very large triangles (edges being up to 5000 units long, and texcoords ranging from…
shadow_map
  • 313
  • 3
  • 15
2
votes
0 answers

frac() function not returning correct value in unity/cg shader

I've been playing with a noise function as part of a shader I'm using and encountered something I don't understand with regards the frac() function, specifically that it is returning the originally passed in number, rather than just the fractional…
Lee
  • 303
  • 3
  • 6
2
votes
2 answers

Transparent between two objects(meshes?)

I'm newbie in Shader Programing. I created a simple shader with a radial gradient, and when they intersect, I want increase transpency. I would like something like this effect: SubShader { Tags { "Queue" = "Geometry+10" } Pass{ …
nipercop
  • 357
  • 1
  • 11
2
votes
0 answers

Frosty water in Unity3D

How can I get water to look frosty? I tried many ways, but no success yet: tried to change vertices of mesh tried to animate normal maps via script tried flowmap But I'm not able to get a "Temple Run: kind of frosty water look. I'd like…
idurvesh
  • 644
  • 1
  • 7
  • 19