PDA

View Full Version : Shader Plugin Coding Question


mpc823_99
10-29-2003, 02:48 AM
Alright, I'm feeling a little foolish here, but after working on my Darktree plugin for a while now, I realize I don't know some things which are quite fundamental. :blush:

First, within the SDK, how does one shade an object in the object's original coordiante system? What I'm trying to do is get the Darktree's to "stick" to the object, but all I can get is the coordinates in world space. So the shader is relative to the world and the objects move right through their surface. Make sense?

Anyway, I've tried using the P and P_orig points, but both seem to give the same results. So, what coordinates do I use to shade this correctly? I think I'm missing something quite fundamental, so I apologize in advance. I'm just so close to getting this thing working well....

Second, why does it seem some of the shaders (noise & multinoise) "stick" and some don't (FuzzyDots and Grid)? Also, how does one set the width and height parameters on the Grid shader? It seems it only allows linking from another node, but surely one could just set them to be a static value?

Sorely confused, :hmm:
Daniel

lmilton
10-29-2003, 06:12 AM
Originally posted by mpc823_99
Alright, I'm feeling a little foolish here, but after working on my Darktree plugin for a while now, I realize I don't know some things which are quite fundamental. :blush:

First, within the SDK, how does one shade an object in the object's original coordiante system? What I'm trying to do is get the Darktree's to "stick" to the object, but all I can get is the coordinates in world space. So the shader is relative to the world and the objects move right through their surface. Make sense?

Anyway, I've tried using the P and P_orig points, but both seem to give the same results. So, what coordinates do I use to shade this correctly? I think I'm missing something quite fundamental, so I apologize in advance. I'm just so close to getting this thing working well....

FX_API(FXint, fxShaderSpotToLocal)(FX_ShaderGlobals *, FX_Point *world_spot, FX_Point *local_spot, FXint flags);

That function will convert the _P to local space.

Second, why does it seem some of the shaders (noise & multinoise) "stick" and some don't (FuzzyDots and Grid)?

Because shaders like Noise, TextureMap, etc. allows the user to choose between Local & World coordinates. By default, they use local. Most shaders will have a "World Coordinates" boolean control.

I don't know about FuzzyDots, but Grid is just a simple example shader script (at least if it's the original one that I coded). It's not intended to be full featured. Further, scripts don't have their own interface... yet.

Also, how does one set the width and height parameters on the Grid shader? It seems it only allows linking from another node, but surely one could just set them to be a static value?

Sorely confused, :hmm:
Daniel


See above.

I hope that was clear...

mpc823_99
10-29-2003, 01:28 PM
Originally posted by lmilton
FX_API(FXint, fxShaderSpotToLocal)(FX_ShaderGlobals *, FX_Point *world_spot, FX_Point *local_spot, FXint flags);

That function will convert the _P to local space.


Thanks Lyle, that helps. Could you give a brief idea of what the other functions do:
fxShaderIncidence
fxShaderLightSpot
fxShaderSpecular


Because shaders like Noise, TextureMap, etc. allows the user to choose between Local & World coordinates. By default, they use local. Most shaders will have a "World Coordinates" boolean control.

I don't know about FuzzyDots, but Grid is just a simple example shader script (at least if it's the original one that I coded). It's not intended to be full featured. Further, scripts don't have their own interface... yet.

See above.

I hope that was clear...

Yes, that was clear. I'll add a World Coordinates check box to my plugin as well.

Daniel

CGTalk Moderation
01-16-2006, 12:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.