Skip to content

Conversation

@donmccurdy
Copy link
Collaborator

Update to match changes from #13916, per #14237 (comment).

I'm not sure this fixes bumpmaps in NodeMaterial or how to reproduce that difference, but the DamagedHelmet example looks correct.

/cc @WestLangley

"vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 map, vec2 mUv, vec2 scale ) {",
"vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 map, vec2 mUv, vec2 normalScale ) {",
" vec3 q0 = dFdx( eye_pos );",
" vec3 q1 = dFdy( eye_pos );",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add workaround for Adreno 3XX dFd*( vec3 ) bug?

@WestLangley
Copy link
Collaborator

/ping @sunag

@sunag
Copy link
Collaborator

sunag commented Jun 19, 2018

Currently bumpMap is converted to normalMap in NodeMaterial but in PR I will going to release I am following exactly the same as in the core.

Just remembering that an extra attention is needed to rename function inputs:
vec2 scale to vec2 normalScale

It is parsed in runtime and can be used with others nodes in functionCallNode.inputs.scale = ....
For example:

var satrgb = new THREE.FunctionNode( [
"vec3 satrgb(vec3 rgb, float adjustment) {",
//" const vec3 W = vec3(0.2125, 0.7154, 0.0721);", // LUMA
" vec3 intensity = vec3(dot(rgb, LUMA));",
" return mix(intensity, rgb, adjustment);",
"}"
].join( "\n" ) );
var saturation = new THREE.FunctionCallNode( satrgb );
saturation.inputs.rgb = tex;
saturation.inputs.adjustment = sat;

@sunag
Copy link
Collaborator

sunag commented Jun 19, 2018

more directly fix bumpMap too since bumpMap uses perturbNormal2Arb

@sunag
Copy link
Collaborator

sunag commented Jun 19, 2018

@donmccurdy
Copy link
Collaborator Author

Looks like @sunag got it, thanks!

@donmccurdy donmccurdy closed this Jun 27, 2018
@sunag sunag mentioned this pull request Jul 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants