Here, we'll start working with UV's. We'll first look at the state variable, tex_list. I will first use tex_list in a shader that translates tex_list into the red and green component of result. In the next section I will combine the quantization function into the uv as colors shader. As I'm no expert in programming, my codes will be a little simpler, but hopefully easier to understand.
Definition
state->tex_list is a pointer to an array containing the texture coordinates of the intersection point in all texture spaces.
Methodology
1. For every point P on surface, find its texture coordinates x and y
2. Color R at point P = x
3. Color G at point P = y
declare shader color "uv_as_colors" () apply material end declare
C Source: uv_as_colors
#include "shader.h" miBoolean uv_as_colors(miColor *result, miState *state) { result->r = state->tex_list[0].x; result->g = state->tex_list[0].y; result->b = 0; return miTRUE; }
Notes
UV as colors |
Pretty straight forward, Red channel is the U coordinate and Green channel is the V coordinate
0 comments:
Post a Comment