[SOLVED] How do I properly setup multiple TEV stages? August 10, 2015 04:18PM | Registered: 10 years ago Posts: 45 |
GX_LoadTexObj(BarbTex.Texture.TexObj(), GX_TEXMAP0); GX_LoadTexObj(CelTex.Texture.TexObj(), GX_TEXMAP1); GX_SetNumTexGens(2); GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GX_SetTexCoordGen(GX_TEXCOORD1, GX_TG_SRTG, GX_TG_COLOR0, GX_IDENTITY); GX_SetNumTevStages(2); GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); GX_SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR0A0); object.RenderModel();
Re: How do I properly setup multiple TEV stages? August 11, 2015 04:21AM | Registered: 13 years ago Posts: 363 |
Re: How do I properly setup multiple TEV stages? August 11, 2015 05:09AM | Registered: 10 years ago Posts: 45 |
Re: How do I properly setup multiple TEV stages? August 12, 2015 03:24AM | Registered: 10 years ago Posts: 45 |
/* NOTE: Set a working light source so that GX_TG_SRTG will work correctly */ // Texture mapped with Cel-shading (using 2 TEV stages) GX_LoadTexObj(BarbTex.Texture.TexObj(), GX_TEXMAP0); // Load model texture to GX_TEXMAP0 GX_LoadTexObj(CelTex.Texture.TexObj(), GX_TEXMAP1); // Load cel shader texture to GX_TEXMAP1 // Prepare TexGens for cel-shading and texture mapping GX_SetNumTexGens(2); GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); // Model texture coords GX_SetTexCoordGen(GX_TEXCOORD1, GX_TG_SRTG, GX_TG_COLOR0, GX_IDENTITY); // For cel-shading // Set TEV stages for cel shading with texture mapping GX_SetNumTevStages(2); // Prepare TEV stage 0 (cel texture) GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD1, GX_TEXMAP1, GX_COLORNULL); // Get TEV color input to texture color GX_SetTevColorIn(GX_TEVSTAGE0, GX_CC_TEXC, GX_CC_C0, GX_CC_ZERO, GX_CC_ZERO); // We don't need the alpha channel of the cel texture as we'll be modulating its intensity to the model's texture GX_SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO); // Set TEV operators to ADD and use default bias and scale values GX_SetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_2, GX_TRUE, GX_TEVPREV); GX_SetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_2, GX_TRUE, GX_TEVPREV); // We'll be ignoring vertex colors since we're going for cel shading based on a texture map so we'll just use GX_REPLACE GX_SetTevOp(GX_TEVSTAGE0, GX_REPLACE); // Prepare TEV stage 1 (model texture) GX_SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); // Take color and alpha values from texture GX_SetTevColorIn(GX_TEVSTAGE1, GX_CC_TEXC, GX_CC_C0, GX_CC_ZERO, GX_CC_ZERO); GX_SetTevAlphaIn(GX_TEVSTAGE1, GX_CA_TEXA, GX_CA_A0, GX_CA_ZERO, GX_CA_ZERO); // Same operator values as TEV stage 0 GX_SetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GX_SetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); // Modulate the final pixel color relative to the cel shader texture GX_SetTevOp(GX_TEVSTAGE1, GX_MODULATE); // Render model (must have normals) object.RenderModel();
Re: How do I properly setup multiple TEV stages? August 12, 2015 04:28AM | Registered: 13 years ago Posts: 363 |
Re: How do I properly setup multiple TEV stages? August 12, 2015 05:41AM | Registered: 10 years ago Posts: 45 |
Re: How do I properly setup multiple TEV stages? August 13, 2015 04:31AM | Moderator Registered: 15 years ago Posts: 686 |