Jump to content

Problem with opacityTexture


eljuko
 Share

Recommended Posts

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;

 

inBabylon.png

inBlender.png

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

Hey gryff!

1. nope, there is no overlapping strips.

2. well it should atleast :D (attached image from blender)

edit:
3. removed the line and transparent areas from image turn black. also the gradient transparency is gone.

hair.png

hairWithoutOpacityTexture.png

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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]
badHairDay.png

Link to comment
Share on other sites

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]
badhairday2.png

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...