eljuko Posted June 5, 2016 Share Posted June 5, 2016 Hey all! I'm having a hard time with opacityTexture. Hair just seem to "flip" somehow. I'v attached some images so you can see the difference. Any idea what might cause that kind of behavior? Code: var material2 = new BABYLON.StandardMaterial("texture2", scene); material2.diffuseTexture = new BABYLON.Texture("data/models/hair.png", scene); material2.opacityTexture = material2.diffuseTexture; material2.backFaceCulling = false; hairModel1 = newMeshes[1]; hairModel1.material = material2; Quote Link to comment Share on other sites More sharing options...
adam Posted June 5, 2016 Share Posted June 5, 2016 What does it look like when backFaceCulling is on? Quote Link to comment Share on other sites More sharing options...
eljuko Posted June 5, 2016 Author Share Posted June 5, 2016 Hey Adam, doesn't look that bad, but it's still there. Quote Link to comment Share on other sites More sharing options...
adam Posted June 5, 2016 Share Posted June 5, 2016 It looks like you are having a similar issue to this one: Quote Link to comment Share on other sites More sharing options...
eljuko Posted June 5, 2016 Author Share Posted June 5, 2016 I'm afraid that didn't fix the issue. It clearly does something, but not as i hoped. i tried values between -10 to 10. Also tried to fix the image in case there was some "hidden" transparency but didn't work either. any other ideas? Quote Link to comment Share on other sites More sharing options...
adam Posted June 5, 2016 Share Posted June 5, 2016 Did you try adjusting the cam.fov value? eljuko 1 Quote Link to comment Share on other sites More sharing options...
eljuko Posted June 5, 2016 Author Share Posted June 5, 2016 Yeah tried to change camera.fov to 0.01 but read that article in a hurry so not quite sure if i did that right. Anyhow. It didnt help either. Edit: will try that again in one hour. Edit2: Tried camera.fov and it didn't work either. Will check the blender file if there's anything i could change, and will report here if i can find any solution for this. Quote Link to comment Share on other sites More sharing options...
gryff Posted June 5, 2016 Share Posted June 5, 2016 Hi @eljuko Two questions: 1. Is the hair mesh made of multiple overlapping strips? 2. Is your texture ("hair.png") an RGBA texture? Does it have transparency? If so, what impact does deleting this line in your code have: material2.opacityTexture = material2.diffuseTexture; cheers, gryff Quote Link to comment Share on other sites More sharing options...
eljuko Posted June 5, 2016 Author Share Posted June 5, 2016 Hey gryff! 1. nope, there is no overlapping strips. 2. well it should atleast (attached image from blender) edit: 3. removed the line and transparent areas from image turn black. also the gradient transparency is gone. Quote Link to comment Share on other sites More sharing options...
gryff Posted June 5, 2016 Share Posted June 5, 2016 Well, eljuko, the reason I asked those two questions is because I have been testing hair much like you - except that my hair model is made from mesh strips. Example 1 - Basic export from Blender of mesh strips model - you can see areas of one mesh poking through another - needs some mesh tweaking. Example 2 - with the additional line of code - ugly The texture I am using is an RGBA cheers, gryff eljuko 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted June 5, 2016 Share Posted June 5, 2016 Quote 3. removed the line and transparent areas from image turn black. also the gradient transparency is gone. Eljuko, what happens to this case if you add this line of code: material2.diffuseTexture.hasAlpha = 1; cheers, gryff eljuko 1 Quote Link to comment Share on other sites More sharing options...
eljuko Posted June 5, 2016 Author Share Posted June 5, 2016 Thanks for the examples! Looks like the example2 has the same issue than mine does. Is it a bug or? Anyhow, gonna pass the lame gradient transparency and make the front part of the hair from strips somewhat like u or just material.diffuseTexture.hasAlpha = true. Thank u! [badHairDay.png] gryff 1 Quote Link to comment Share on other sites More sharing options...
eljuko Posted June 5, 2016 Author Share Posted June 5, 2016 11 minutes ago, gryff said: Eljuko, what happens to this case if you add this line of code: material2.diffuseTexture.hasAlpha = 1; cheers, gryff Added img. Atm this is the way to go i think. Just need to do some work with the image now [badHairDay2.png] Quote Link to comment Share on other sites More sharing options...
gryff Posted June 5, 2016 Share Posted June 5, 2016 Quote badHairDay.png eljuko - made me spill my coffee Watch out if you work with mesh strips (a common technique) for those nasty overlaps. cheers, gryff Quote Link to comment Share on other sites More sharing options...
eljuko Posted June 5, 2016 Author Share Posted June 5, 2016 Thank you both for wasting ur time trying to resolve my issues 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.