Rincelent Posted May 9, 2017 Share Posted May 9, 2017 Hi, I'm currently using babylon for a project and I need to get one mesh with alpha < 1 and shadow. The other mesh with alpha should not have any shadow. As far as I dig it seems currently impossible, as ShadowGenerator._shadowMap._transparencyShadow would the way to do it and takes effect on all mesh. Is there any way to reach my goal in current version of babylon? If not, would it be ok, if i had a parameter on Babylon.mesh like _castShadowOnTransparency in a PR? Anyway I hope i'm clear, when i'm into, something i tend to consider some essential things to be evident for everyone . Quote Link to comment Share on other sites More sharing options...
Temechon Posted May 9, 2017 Share Posted May 9, 2017 Hi, Let's say you have a mesh with alpha (mesh1) you don't want to generate a shadow and a mesh you want to generate a shadow (mesh2) . You can just do something like this : shadowGenerator.getShadowMap().renderList.push(mesh2); // Don't push mesh1 as you don't want a shadow for this. Would this work for you ? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 9, 2017 Share Posted May 9, 2017 Hi guys! @Temechon, I THINK Rinc wants mesh with .visibility = .5, or with material.alpha = .5, or with opacityTexture.level = .5 ... to STILL cast shadows... even though they are partially transparent. Perhaps they cast less-dense shadows. But maybe I misunderstood. I borrowed a playground, then did serious-overkill modifications (added all green boxes, and boxMaterial2 [green], and pushed boxes into SG renderlists). http://www.babylonjs-playground.com/#20FROK#4 Play areas - line 65, and lines 83-90, watch green boxes. Whenever mesh alpha/visibility < 1, shadow is gone. Is that normal? Not sure. Quote Link to comment Share on other sites More sharing options...
Rincelent Posted May 9, 2017 Author Share Posted May 9, 2017 @Temechon , this is working thanks. Althought i thought it's a bit strange to have to update the render list if you update texture (has i have to delete them from render list if the texture has alpha on a "normal" mesh). @Wingnut As far as I see the engine support alpha like a boolean maybe i misunderstood the code but i don't think so. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 9, 2017 Share Posted May 9, 2017 Hey Rinc... did you see that other topic? ShadowGenerator.setTransparencyShadow(true) ? (thx deltakosh!) http://www.babylonjs-playground.com/#20FROK#5 I installed it in all 8 generators. Green boxes showing shadows. (same shadow darkness-bias as non-alpha mesh, but still, there it is.) Cooooool. I tested with all three types of visibility-removers. Works fine. Weird that two forum users would need same solve on same day, within hours. hmm. Quote Link to comment Share on other sites More sharing options...
Rincelent Posted May 10, 2017 Author Share Posted May 10, 2017 As i said, this particular solution doesn't solve my problem. Has the shadow is not affect at all, by alpha when the parameter is set (we don't have something like smooth shadow, but shadow or not shadow). Plus I want that my transparent mesh don't cast shadow in the general case I just have one exception. Still don't bother with it .Although it's a bit complicated for what I need to do the solution of Temechon is working. Wingnut 1 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.