royibernthal Posted January 9, 2017 Share Posted January 9, 2017 I'd like to tint a model to black with a certain amount of transparency, let's say 60%, in a way that you'll be able to see the model's texture beneath the black tint, at 40% clarity. I created a material with black diffuse color, and applied it to the model's meshes. It is pitch black though, is there a way to make it only 60% tinted? http://www.babylonjs-playground.com/#1SVN3I#57 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 9, 2017 Share Posted January 9, 2017 http://www.babylonjs-playground.com/#1SVN3I#58 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted January 9, 2017 Author Share Posted January 9, 2017 Not what I had in mind. What you did sets the whole mesh to pitch black and then sets the alpha of the whole thing (still in pitch black), instead of just the alpha of the black "layer" on top of it. Attached an image that helps explain what I need - left side is 50% black tint, right side is no tint. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 9, 2017 Share Posted January 9, 2017 to do entire scenes, you need to add a post-process. See a black & white one, but a tint. You could also a a 2nd ortro camera that can only see one mesh using layer masks. That mesh would have the tint material. Good luck. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted January 9, 2017 Author Share Posted January 9, 2017 Not entire scenes, only specific meshes. Isn't there a simpler solution? Maybe something in the lines of reflect back 50% less light from the mesh. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted January 9, 2017 Share Posted January 9, 2017 You're replacing the sheeps material with a new, black material right now.. as i've understood, you want to keep the texture, but make it darker? Quote Link to comment Share on other sites More sharing options...
royibernthal Posted January 9, 2017 Author Share Posted January 9, 2017 You understood correctly, any idea how to do that? Here's a fixed PG where I modify the existing material instead: http://www.babylonjs-playground.com/#1SVN3I#59 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted January 9, 2017 Share Posted January 9, 2017 @royibernthal here's a bit of a hack, using light instead; http://www.babylonjs-playground.com/#1SVN3I#60 i can't help you otherwise with editing the texture live. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted January 10, 2017 Author Share Posted January 10, 2017 Nice hack, the result is what I wanted, but the way is too convoluted, given I'm dealing with multiple models, each having multiple meshes. Worst case scenario I guess I can have 2 global lights, 1 dimmed and one normal, and constantly include and exclude meshes from them. With that said, surely there is a simpler way to control the percentage of light a mesh reflects back? Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted January 10, 2017 Share Posted January 10, 2017 yes, changing the intensity of the light itself that is, to my knowledge, the only way at the moment. royibernthal 1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted January 10, 2017 Author Share Posted January 10, 2017 haha I see, thanks. Fingers crossed there's an extremely simple parameter that DK is about to tell us about Quote Link to comment Share on other sites More sharing options...
Kesshi Posted January 10, 2017 Share Posted January 10, 2017 you could also use the renderOverlay feature: http://www.babylonjs-playground.com/#1SVN3I#61 royibernthal and aWeirdo 2 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted January 10, 2017 Share Posted January 10, 2017 @Kesshi Nice one! never seen that before, i guess that's exactly what @royibernthal needs Quote Link to comment Share on other sites More sharing options...
royibernthal Posted January 10, 2017 Author Share Posted January 10, 2017 Just what I needed! Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.