Exclude a mesh from a light
Blitz3D Forums/Blitz3D Programming/Exclude a mesh from a light
| ||
I have two near lights and a mesh. How to to exclude this mesh from one of the two lights? Maybe tom dll? |
| ||
Multipass rendering. Something like: Start of loop Show everything CameraClsMode cam,True,True Hide light1 RenderWorld CameraClsMode cam,False,False Hide light2 Show light1 RenderWorld End of Loop |
| ||
Yes but it would be too slow... :( |
| ||
not if done right. take a look at this: http://blitzbasic.com/codearcs/codearcs.php?code=1246 |
| ||
Set the mesh to full bright. Then use entity color to reduce the brightness of the entity is one way. |
| ||
![]() As you can see, every character has to be enlightned by the light of the room he's in. CharD has to stay dark. How many multipass rendering I'd need? Wouldn't the rooms be rendered 3 times? Perhaps I just didn't understand CameraClsMode function? |
| ||
I would render the rooms once, with all the lights on (With cameraClsMode cam,True,True set). Then render each character individually, with only the light that's in the same room as he is (using CameraClsMode cam,False,False). That way you're still only rendering everything once. |
| ||
To render every character individually I need to hide the rooms.. right? Isn't Hideentity too slow? |
| ||
Yeah, hide the rooms. You're disabling clearing of the z-buffer with CameraClsMode after the first render, so the geometry of what's already been rendered will still be taken into account when you render the characters - i.e. if a character is behind a wall, you still won't be able to see him. Try it and see. HideEntity is extremely fast. |
| ||
Ok!I'm going to try! Thank you :) |
| ||
Wait... So not clearing the z-buffer actually allows you to render meshes behind other previously rendered? Man... i feel sooo stupid now... |
| ||
Uhm I have a problem now:the particle sprites are always behind the chars and if I don't hide them, they are rendered 3 times. please don't tell me that sprites don't write on the Zbuffer :( here's my loop: Show level Hide chars Show particles CameraClsMode camera,True,True *RenderWorld* Hide Cur_Level Hide particles CameraClsMode camera,False,False Show chars(for light1) *RenderWorld* Show chars(for light2) *RenderWorld* |
| ||
If they are using a blend mode where you can see through them (they default to add blending) then no they are not written into the z-buffer. This is why polygons with alpha transparency are sometimes rendered in the wrong order when they overlap. I think the solution is to only render your sprites once after everything else. They will be affected by the z-buffer, they just don't affect the z-buffer themselves. |
| ||
Ok I rendered particles after everything else. thx It works. Btw I think there's a problem with this multipass method. Characters are rendered even if they are out of the screen?! Trisrendered() after each *render* outputs as if it drew every character. No more object culling with CameraClsMode camera,False,False ? Forced to use EntityInView? |
| ||
Oh no!The chars cover level alphablended faces... |
| ||
They will only be rendered if ANY of the character is shown. In fact, i'm sure it's the bounding box of the character. So even if you can't see any of the character. It's bounding box may be on screen. |