Cg is a high-level shading language developed by Nvidia.
Questions tagged [cg]
300 questions
1
vote
1 answer
Is there a way to ensure that an object is always displayed on top of another with no overlaps?
I'm having some issues with items of clothing on an avatar as you can see in the image below
Most would suggest that i simply pull the trousers away from the body within the modelling software which is fine until it is combined with other items of…

Zaine Abaddin
- 51
- 1
- 7
1
vote
1 answer
Getting an error using a uniform 1D texture parameter with CG and openGL
I am trying to write a basic volume renderer which uses opengl, and cg for writing shaders. I'm putting my transfer function in a one dimensional texture, and using that in a dependent texture lookup in the fragment shader. My problem is that I'm…

Bwmat
- 4,314
- 3
- 27
- 42
1
vote
1 answer
multiplying vertex data causes uneven outline (shaderlab unity3d)
I have created a simple outline shader in Unity3D's shader lab with two passes: pass one scales the object up by multiplying vertex information along a vertex normal and pass two draws the regular (base pass) version of the object. The problem is in…

rbjacob
- 193
- 3
- 14
1
vote
1 answer
Why CGAL read mesh failed?
I read mesh (.off) by CGAL::read_off(fin,mesh) like examples, but it is failed!
this is my code:
#include
#include
#include
#include
#include…

LiLingjie
- 11
- 1
1
vote
2 answers
How can i convert uv coordinates to world space?
I am trying to implement a shader. It will use with Unity LineRenderer. Shader will have noise that scrolling overtime raltive to texture coordinates. For example in parallel to x axis of uv space of texture. I have an implementation, but i…

Sergiy Klimkov
- 530
- 7
- 15
1
vote
3 answers
Solution to "function 'floor' not support in this profile" in Ogre3D cg fragment shader
I am reading the book "Ogre3D 1.7 Beginngers guide".I writed a cg fragment shader but encountered the complier complain, "function 'floor' not support in this profile".
The fragment shader definition is here:
fragment_program MyFragmentShader8…

Liu
- 645
- 2
- 8
- 16
1
vote
1 answer
Rotate a direction vector by another direction
I have a direction vector (A) that is pointing upward (0, 1, 0) and I want to be able to rotate it to another direction in a shader but only on one axis, in this case, the Z axis. This can be done using a vector (B) or a scalar.
As an example,…

MaT
- 1,556
- 3
- 28
- 64
1
vote
1 answer
Unity 3D Subsurface Shader setting normal for appropriate lighting
I'm attempting to write a simple wave-like shader in Unity 2017.1.0f3 using the sin function, however it's all an undefined one color shape without redefining the normals so it can get the shading right. However despite my maths I can't seem to get…

F. ElRayes
- 11
- 3
1
vote
1 answer
Prevent ColorMask obscuring parts of an object's mesh
I am trying to use a shader to prevent an object being rendered when it leaves a specific area. However, when using a surface shader to do this, to fix drawing issues I have to use a depth buffer. Currently I am doing this by
Pass {
ColorMask…

Dan
- 7,286
- 6
- 49
- 114
1
vote
0 answers
Triple integral of perlin/simplex noises
I'm wondering if it were possible to get the triple integral of a 3d noise function (for example perlin or simplex noises). I searched a little over the web but i haven't found any result.. if it were possible, we could calculate the sum of all…

Gugu
- 73
- 7
1
vote
0 answers
How to achieve normal/bump map on surface shader (Unity C#)?
I have problems with the following CG surface shader. My goal is to have a NORMAL MAP used on the terrain the shader belongs to. When I apply the shader it doesn't throw any errors, but my terrain becomes black instead of having it's Main Texture…

M_NEN
- 135
- 1
- 3
- 13
1
vote
1 answer
Receive and cast shadows (custom GEOMETRY Grass Shader) - Unity C#
I was following a tutorial made by Sam Wronski aka. World of Zero (Tutorial by World of Zero) where he codes a geometry shader for a point cloud grass generator. Great tutorial but I am wondering (and didn't find a proper solution after days of…

M_NEN
- 135
- 1
- 3
- 13
1
vote
1 answer
CG shader works on DirectX but not Opengl
I am trying to write a simple blur fragment shader that supports float NaN values, but it is giving me unexpected results on OpenGL. I use floating point textures and set the green channel to 1 if the pixel is NaN, otherwise set the red channel to…

Malik Drako
- 577
- 1
- 8
- 19
1
vote
1 answer
Alpha channel not working correctly on vertex shader
I seem tobe having some issues with the order its drawning or something like that.
Im using vertex colors.
If I set the alpha of the bottom vertices to 1 again I still get that draw issue on the top of the pillars.
If I set the queue to opaque it…

Nicholas Tsaoucis
- 1,381
- 2
- 17
- 39
1
vote
0 answers
unity mvp Matrix on ios
I am working on water simulation, I need to sample _CameraDepthTexture to get Opaque depth, it works well on Windows. But the shader get different depth on IOS.
vert:
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.ref =…

youyouyou
- 23
- 4