Page 1 of 1

multiple shaders on a 3d Object (uv surfaces requires own shader)

Posted: Mon Feb 21, 2022 5:16 pm
by therealityasis
Dear team,

I would like to have advice/idea regarding the following:

When importing a 3d object (.obj) the uv's can be set to a material.
Ideally i would like to set a different material (shader) on each side of the imported 3d model.
The model will be rotated often (dynamically rotating). materials mapped on the uv surface makes them stay in the correct place when rotated.

The issue starts that only one material input can be used.
I can copy the model multiple times and put a material on a side and then multiply or ad the model outputs, though it is very tricky to do as the material/shader is not stopping at the uv surface it is placed . Is there a more elegant way to tackle this?

some thoughts would be of much much help. Will try to add image and animation here to illustrate the question

https://1drv.ms/u/s!AlUf_zHwK2PLlelgQom0EKkAV3K-mQ

https://1drv.ms/u/s!AlUf_zHwK2PLlelf-Km ... A?e=IuydJw

Re: multiple shaders on a 3d Object (uv surfaces requires own shader)

Posted: Thu Feb 24, 2022 1:38 pm
by therealityasis
to whoever it may concern,

I was helped with the issue. There is a method of correctly do it to make it work.
I copy Pat's answer here:


Yes, there is a trick...
The following picture was done for a similar question, but for multiple projectors mapping the same object.
The idea is to create a "fake" projector you'll use to composite your texture according to the uv's. Set 'destination' to 'none' and check 'internal loopback'.
To work more confortable, export the UV's picture from your package, or make a screenshot of it in madmapper( black background ), crop it and use it as the top layer ( with 'stencil luma' blend mode ). ​Toggle on/off visibility of it when needed.

Here a ( very ) fast example :


You can see the unwrapped texture of an obj on the left, where is applied the internal loopback of a "virtual" projector ( the one on the bottom right )
So the 3 obj are duplicated on different projector's view ( aligned differently ) and share the same texture. So once your setup is in place, you only need to update what appends in this rect, the obj textures will follow... and if your setup moves, just realign the objects orientation ( calibration ), because ​everything is animated on the faces.

Re: multiple shaders on a 3d Object (uv surfaces requires own shader)

Posted: Wed Jul 19, 2023 4:28 am
by Jesse69
This lovely trick of using a "fake" projector with internal loopback and stencil luma blend mode to composite textures based on UVs has left me amazed by its ingenuity and creative approach to achieving seamless projection mapping results.
build now gg

Re: multiple shaders on a 3d Object (uv surfaces requires own shader)

Posted: Thu Jul 27, 2023 11:38 pm
by mad-matt