DylanD Posted August 9, 2018 Share Posted August 9, 2018 Hello everyone, I have a problem, I have a standard material with a texture, and I want to use diffuseColor to make it look purple, it normally is blue, so I try adding red, but that doesn't seem to do anything. I found a similar problem in the playground, where I can turn the one ball red but the other ball will not turn blue. I don't understand why this happens. http://www.babylonjs-playground.com/#20OAV9#218 is there a way around this? Is this normal? Any ideas? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 9, 2018 Share Posted August 9, 2018 It is all expected as the light does not contain any blue, it means all your diffuse blue part will not be visible and the only color resulting from diffuse will be black added to your emissive texture resulting to only the color of the the emissive texture. The way around it is either to use emissive color so that it is not impacted by the lights or to add some blue in you light diffuse color. Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 9, 2018 Author Share Posted August 9, 2018 15 minutes ago, Sebavan said: It is all expected as the light does not contain any blue, it means all your diffuse blue part will not be visible and the only color resulting from diffuse will be black added to your emissive texture resulting to only the color of the the emissive texture. The way around it is either to use emissive color so that it is not impacted by the lights or to add some blue in you light diffuse color. In my scene it seems that all of my lights have 1,1,1 so white light which should include blue red and green, but I can't get red to show, also I tried emissive color and it didn't seem to make change the texture at all. Thank you though, now I know what to look for. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 9, 2018 Share Posted August 9, 2018 Do not hesitate to create a repro closer from your scene in the playground. Also when using texture + color, it is a multiplication so if the texture has no blue, the result will not be blue even if the color contains blue : "emissive = emissiveColor * emissiveTexture" Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 9, 2018 Author Share Posted August 9, 2018 21 minutes ago, Sebavan said: Do not hesitate to create a repro closer from your scene in the playground. Also when using texture + color, it is a multiplication so if the texture has no blue, the result will not be blue even if the color contains blue : "emissive = emissiveColor * emissiveTexture" I would like to make a much more accurate playground but I have a complicated scene and many scripts. The texture doesn't really have any red in it at all only blue and green, so it won't show red? Not sure I understood that right. So since it is multiplicative theres no way to get any red? Is there a way I could do it using additive? Would diffuseColor also work using multiplication? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 9, 2018 Share Posted August 9, 2018 finalColor = diffuseColor * diffuseTexture * light + emissiveColor * emissiveTexture Basically if you use diffuse without red, you could put red in emissive or try the opposite. Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 9, 2018 Author Share Posted August 9, 2018 im going to put this on the back burner for a while. If I figure it out il let everyone know. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 9, 2018 Share Posted August 9, 2018 http://www.babylonjs-playground.com/#20OAV9#219 DylanD and NasimiAsl 1 1 Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 10, 2018 Author Share Posted August 10, 2018 14 hours ago, Pryme8 said: http://www.babylonjs-playground.com/#20OAV9#219 Hey Pryme8 this worked perfectly! 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.