Starting with shaders

Posted By: Trev101524

Starting with shaders - 03/17/06 17:47

Hi, I have decided to take my first steps into shaders, and have a question or two. From what I have read from other posts, you must use an .fx file for shaders. Is this a plain .txt file saved as .fx??? Also, I know that shaders are written in HLSL, but how do you include the .fx file, written in HLSL, in your main c-script code??? Do you just use the include command??? Thank you for your time.
Posted By: ulillillia

Re: Starting with shaders - 03/17/06 19:06

In short, materials use shader codes with the effect command. FX files are apparently plain text format (unformatted text). I don't know how shaders work or how they are written (they're not in the manual).

Code:

material quicktest
{
ambient_red = 255; // full brightness
ambient_green = 255;
ambient_blue = 255;
effect = "
technique technique_name
{
pass p0
{
// insert shader code here
}

// pass p1 // for additional passes
}

// technique simpler // additional techniques for lower end cards
" // end effect string
}

action my_action
{
my.material = quicktest; // assigns the material for the shader
}



This is as far as I can go. The manual only gives the information I've given. It doesn't explain how to do any calculations, or what the other options are available. I wished it did though.

This thread, however, should be moved to the shaders forum....
Posted By: Trev101524

Re: Starting with shaders - 03/17/06 19:15

I agree ulillillia, my first thought was... read the manuel. However, I was very disapointed by the description of shaders... practically nonexhistant, as you said. So, I found some intro to HLSL documents and am trudging through those now. Thanks for the speedy response, I will just "trial and error" my way through shaders I guess... (most like more error than trial). Thanks again.
Posted By: broozar

Re: Starting with shaders - 03/18/06 13:29

Quote:

Is this a plain .txt file saved as .fx???



jepp.
Quote:

Also, I know that shaders are written in HLSL, but how do you include the .fx file, written in HLSL, in your main c-script code???



The WIKI is your best friend with this! username/password: acknex
© 2024 lite-C Forums