Although it is possible to get RenderMonkey to display multiple meshes, it was not designed to do so. It does support multiple textures for a single mesh though - take a look at the default DirectX effect called "Multiple Render Targets". The first pass will render two different textures, and the second pass applies these two textures to the surface of the teapot. Once you have a pass, you can right-click on the pass node and "Add Texture Object" which will add a sampler to a texture.
I hope that helps,
Hi, creating multiple passes was not something I wanted to do, as I simply wanted a drag and drop solution, that would apply the same shaders.
I did try a different approach(albeit ugly) where I pass a texture ID in on the PS input
float4 position : POSITION0;
float3 normal : TEXCOORD0;
float2 uv : TEXCOORD1;
int4 texture_id : TEXCOORD2;
Then, I have the ugly routine..
float4 get_diffuse( int id, const float2 uv )
if ( id<1 ) return tex2D(Texture0, uv);
if ( id<2 ) return tex2D(Texture1, uv);
if ( id<3 ) return tex2D(Texture2, uv);
if ( id<4 ) return tex2D(Texture3, uv);
if ( id<5 ) return tex2D(Texture4, uv);
However, the logic of this works fine, but depending on the render position, the id changes, which I have yet to fathom.
Even if I ensure the VShader sets it to the same value for every vertex, I still get wieird noise.
I presume, some sort of interpolation is happening, but I cannot fathom why, as the values are the same.
Currently debugging the PS shaders in PIX to try and work it out.
Would the above approach actually ever work?
Ok, Im not totally sure why, but I have resolved the issue by reversing my crappy lookup.
it now reads..
if ( id>3 ) return tex2D(Texture4, uv );
if ( id>2 ) return tex2D(Texture3, uv );
if ( id>1 ) return tex2D(Texture2, uv );
if ( id>0 ) return tex2D(Texture1, uv );
return tex2D(Texture0, uv);
I will close this one