kenc
October 9, 2019, 1:58pm
#1
Hi All
First posting to Playcanvas. I’m not a playcanvas user but I am working with a colleague who is.
I am trying to emulate the blend between a RGB value and a texture map in the editor. I am trying to emulate it in 3DSMAX, to create the same look as it looks in the playcanvas editor.
TIA
will
October 9, 2019, 2:04pm
#2
The code is here:
#ifdef MAPCOLOR
uniform vec3 material_diffuse;
#endif
#ifdef MAPTEXTURE
uniform sampler2D texture_diffuseMap;
#endif
void getAlbedo() {
dAlbedo = vec3(1.0);
#ifdef MAPCOLOR
dAlbedo *= material_diffuse.rgb;
#endif
#ifdef MAPTEXTURE
dAlbedo *= texture2DSRGB(texture_diffuseMap, $UV).$CH;
#endif
#ifdef MAPVERTEX
This file has been truncated. show original
So, in your case, you have MAPCOLOR and MAPTEXTURE defined. So the math is:
albedoColor = tintColor * diffuseMapColor
kenc
October 9, 2019, 2:09pm
#3
Thanks Will
So this is a multiplication of the tint on top of the texture? If so, could I use the Photoshop multiply algorithm?
will
October 9, 2019, 2:10pm
#4
Sounds like it should do the same.
kenc
October 9, 2019, 3:17pm
#5
Thanks Will
I’ll give that a try. Now to find the Photoshop equation. Any ideas?
Hi @kenc ,
This will come in handy: https://github.com/jamieowen/glsl-blend
It includes a collection of .glsl files containing most of the Photoshop blending modes.
kenc
October 9, 2019, 3:28pm
#7
Thanks Leonidas, I will check it out. I will also report back with my results, but it may not be till next week.
Thanks again Will and Leonidas.