Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputNode readonly option #13250

Merged
merged 13 commits into from
Feb 7, 2018
Merged

InputNode readonly option #13250

merged 13 commits into from
Feb 7, 2018

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Feb 4, 2018

Not use uniform input if readonly is true in InputNode. ( for optimization )

in new THREE.Vector3Node( 1, 1, 1 ) instead use explicit declaration, for example:

// readonly = true
vec3( 1.0, 1.0, 1.0 )

// readonly = false (default)
uniform vec3 nV0;

Of course. readonly not allow change the value after build the shader material.


In NodeFrame I rename updateFrame to updateNode which is more suggestive but keeping updateFrame in nodes.

@sunag
Copy link
Collaborator Author

sunag commented Feb 5, 2018

@mrdoob @WestLangley What do you think about rename the property coord to uv of TextureNode and CubeTextureNode?

@sunag
Copy link
Collaborator Author

sunag commented Feb 5, 2018

Other thing... 'transform' is a position offset and normal is a normal offset.

@sunag
Copy link
Collaborator Author

sunag commented Feb 5, 2018

'transform' is a position offset

my mistake. actually transform is a local position.
to create an offset, is need:

material.transform = new THREE.OperatorNode(
	new THREE.PositionNode(),
	displaceNode,
	THREE.OperatorNode.ADD
);

but normal is a normal offset. currently to create a normalMap is need:

mtl.normal = new THREE.TextureNode( getTexture( "grassNormal" ) );

but it could be like this:

mtl.normal = new THREE.NormalMapNode( new THREE.TextureNode( getTexture( "grassNormal" ) ) );

and allow normal slot to others customized NormalNode.

Are some thoughts...

@WestLangley
Copy link
Collaborator

mtl.normal should be renamed mtl.normalMap, but this looks like the right API to me:

mtl.normalMap = new THREE.NormalMapNode( new THREE.TextureNode( getTexture( "grassNormal" ) ) );

@sunag
Copy link
Collaborator Author

sunag commented Feb 5, 2018

This doubt about normal came when add NormalNode in normal slot.

// following the logic. I think that it should work:
mtl.normal = new THREE.NormalNode();

@sunag
Copy link
Collaborator Author

sunag commented Feb 5, 2018

however, mtl.normal is like as mtl.normalOffset in pratice


var value = this.number;

return builder.format( ~~value !== value ? value : value + ".0", type, output );
Copy link
Owner

Choose a reason for hiding this comment

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

Minor thing: I don't think using these bitwise operations are worth it these days (speed vs readability).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Instead what do you recommend parseInt or Math.floor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that Math.floor is "more" number-oriented.

@mrdoob mrdoob added this to the r90 milestone Feb 7, 2018
@mrdoob mrdoob merged commit 4ef0d67 into mrdoob:dev Feb 7, 2018
@mrdoob
Copy link
Owner

mrdoob commented Feb 7, 2018

Thanks!

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