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

add a way to name uniform / texture #30703

Open
Makio64 opened this issue Mar 10, 2025 · 2 comments
Open

add a way to name uniform / texture #30703

Makio64 opened this issue Mar 10, 2025 · 2 comments
Assignees
Labels
TSL Three.js Shading Language

Comments

@Makio64
Copy link
Contributor

Makio64 commented Mar 10, 2025

Description

For helping debugging it will be great to add a .name( ... ) so we can do let opacity = uniform( 0.5 ).name('opacity').

Currently it seems only varying and var can be name.

Solution

uniform(...).name( name )
texture(...).name( name ) as texture extends uniform it didnt need extra code

Alternatives

.name( name ) also for varying and toVar.

NOTE : let txt = texture( ... ).toVar( name ) is not working as after we cant use it with txt.sample(...) for example.

Example

This demonstrate the .toVar( .. ) not working with texture(...)
https://jsfiddle.net/4epnsd60/9/

@mrdoob mrdoob added the TSL Three.js Shading Language label Mar 11, 2025
@sunag
Copy link
Collaborator

sunag commented Mar 11, 2025

Have you tried with .label()?

@Makio64
Copy link
Contributor Author

Makio64 commented Mar 12, 2025

Thanks @sunag , it does what i was looking for.

It's worth adding it to the wiki : https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language

Also would you consider change .label( name ) to .name( name ) ?
.name( name ) seems more simple and align with little-gui as well as the current doc in the wiki : .toVar( name = null )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TSL Three.js Shading Language
Projects
None yet
Development

No branches or pull requests

3 participants