Is this possible?
Helper last edited by
On 11/05/2014 at 21:09, xxxxxxxx wrote:
Greetings to all!
I'm looking at developing my first plugin for C4D (written in C++), but first I'd like to know if this is even possible or if there's some kind of limitation I'm going to run into while trying to implement this.
I'm trying to render a bunch of game models for a project I'm working on. We overlap our UVs to save on texture space, since there's really no point having duplicate pixels on the texture if you don't need them. That means that anything symmetrical on the game model (texture wise) has UVs that are flipped across U then overlaid on top of the original side.
Models configured like this tended to render just fine in R13 and below. When R14 came out (and R15 continues this trend), this changed in that you now get a big fat normal mismatch down the centre of the model. The overlapping portions of the UVs need to have their X and Y channels flipped (red and green) in order to display properly. Likewise, bump maps need a similar treatment, though you just need to invert the entire greyscale image.
What I'd like to do is to write a shader that somehow takes care of this for me. The shader would only have one slot for another texture, and no other options. If the shader was placed under the normal channel, then it would automatically flip the red and green portions of any image using 2D UV space that falls on an overlapping UV. If the shader was placed under the bump channel, it would automatically invert any portions of the image using 2D UV space that fall on an overlapping UV.
What I'm not sure about is:
If you can even differentiate between volumetric (3D shaders) and UV space shaders, and separate those if all you have is input from something like a Layer shader (since we only care about UV space stuff here, anything in 3D space wouldn't use the UVs so that doesn't matter)
If it's even possible to determine what channel the shader is placed in
If it's even possible to determine which UVs are flipped or not
Does anyone know if it would be possible to write this kind of shader? I'm not asking anyone to actually write the thing for me, I'll do that myself- I just want to know if I can achieve this sort of functionality, or if I'm doomed to fail right off the bat.