Forums > Jitter

Cg as shader language


efe
May 4, 2009 | 12:38 pm

Hello everyone:
I was wondering if anyone in this forums has ever used Cg as a language to write jitter shaders. It seems that Cg is quite close to HLSL which means that is possible to translate and use some vvvv shaders with jitter(which would be really cool!).

Thank you!

Emmanuel


May 4, 2009 | 5:42 pm

There are some Cg examples in the jitter-shaders folder. Take a look at mat.phong.cg.jxs.

wes



efe
May 4, 2009 | 5:57 pm

Thank you Wesley:
I took a look into the shader folder and it seems that besides the mat.phong.cg.jxs and the shared files(the passthru stuff) there are no more Cg examples.
Any suggestion of more sources?
Thank you!
Emmanuel


May 4, 2009 | 6:25 pm

I have just posted a question with shader in cg, i am also struggling to understand how jitter use cg..

http://www.cycling74.com/forums/index.php?t=msg&th=39412&start=0&rid=4570&S=aa04f349d63dbbaed80e635e5c932bde

take a look if you have question don’t hesitate, i’ll do my best!

have a nice day!

Mani



efe
May 4, 2009 | 6:49 pm

Thank you Mani:
Indeed, it seems that the documentation on writing Cg shaders is quite limited.
Someone please correct me but, among some other things, working with Cg shaders would help the ‘translation’ from HLSL native shaders into GLSL.
One more comment, I do think that this community deserves a shader forum so we can trace clearly the treads and the people working in sunny shaderland.
Thank you again for your reply
Emmanuel


May 4, 2009 | 9:48 pm

cg shaders in jitter work pretty much the same way that glsl shaders work. and as the best reference for glsl is the orange book, the best reference for cg is the cg tutorial (as well as tons of other free resources on the nvidia website).
http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter01.html

if you have a specific question, please ask.

@mani – jitter does not currently support cgfx.


May 5, 2009 | 4:39 pm

Thanks robtherich!

In fact i have some question about how slab handle the shader…

In the link that I posted before, I have a problem with a feedback from a slab to the same slab, it always receive 0.0 in the texture so I am trying to pinpoint the problem.

So it would really help if i could understand better some stuff like.

What are the texture coordinates that the slab object passes to the vertex shader, usually from a quad it is already between 0 and 1, 0 0 is the upper left corner and 1 1 the lower right corner, so why do I need to multiply it by state.matrix.texture[0] ?

Am I right to say that this matrix state.matrix.texture[0] is a transform from a space coordinate, that a don’t know, to the screen space coordinate?

If so if I have and other texture coming in a second inlet do jitter will send the coordinates from the second texture in the texcoord1? and so I have to multiply those uv by state.matrix.texture[1] ? Am-I right?

Also in the jxs file I can set the state of parameter that can be send to the shader or can I only specify it in the file that contain the code
Do I have to put the worldviewproj and other like that in the jxs? or i can only specify it in the corresponding shader file. i.e. to put only in the vertex program file the variable float4x4 matViewProj : state.matrix.mvp;

well that it for now thank in advance!

Mani


Viewing 7 posts - 1 through 7 (of 7 total)