• Advertisement

Archived

This topic is now archived and is closed to further replies.

Shading question

This topic is 5757 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have met the following code somewhere in a directx book. /* This example uses a dot product to square the vertex diffuse color components. */ // The shader is shown below. ps.1.0 // Version instruction. tex t0 // Declare texture. dp3 r0, v0, v0 // Dot product squares the vertex color values, // color(v0) * color(v0). // Bright colors max out at white. // Dimmer colors yield gray. in this code, the square of the vertex color values are achieved by dot product. Isn''t that tedious comparing to just go v0 * v0; is there any special purpose of doing in that way?

Share this post


Link to post
Share on other sites
Advertisement
v0 is a vector, which means that there is really no such thing as v0 * v0. The dot product is the most appropriate operation in this case.

Share this post


Link to post
Share on other sites

  • Advertisement