Home › Forums › Programming › Change Emission Intensity of Texture
- This topic has 7 replies, 3 voices, and was last updated 7 years, 11 months ago by
donalffons.
-
AuthorPosts
-
2018-01-05 at 3:05 pm #1552
donalffons
CustomerHappy new Year :)!
I have a simple texture setup in Blender, which looks like this:

I would like to dynamically change the ‘Emit’ Parameter of the ‘Extended Material’ through java script, i.e. with
window.v3dApp.scene.children[0].children[5].material.???
…and then…?! How can I do that? Or is there maybe an alternative way of defining textures with varying emission intensities?Help would be greatly appreciated!
Regards
-Sebastian2018-01-05 at 3:30 pm #1553donalffons
Customer…I did a bit more digging and found that the extended material node seems to live here:
`window.v3dApp..scene.children[0].children[5].material.nodeGraph.nodeInfo’

But changing the values doesn’t do anything to the looks of my material. Do I have to call some kind of update function to get this to work?2018-01-05 at 4:38 pm #1556
Yuri KovelenovStaffHi,
Happy new Year :)!
Same to you :)
Do I have to call some kind of update function to get this to work?
Off the top of my head, material internals should get updated if you
set its ‘needsUpdate’ param to true.
https://www.soft8soft.com/docs/#api/materials/Material2018-01-05 at 6:56 pm #1558donalffons
CustomerI made a simplified test scene (download)
The cube on the left has Emit = 1, the one on the right has Emit = 0.The following code does nothing
2018-01-06 at 1:27 pm #1562donalffons
Customer…I can even delete the complete node graph without any changes and complaints:

Therefore it doesn’t seem like the nodeGraph is touched anywhere.2018-01-07 at 8:23 am #1565
Yuri KovelenovStaff2018-01-08 at 6:27 am #1574
Alexander KovelenovStaffHi, in Verge3D we support dynamic assignment/editing output values for Value and RGB nodes. So basically you need to connect Value node to Emit input and assign values through material.nodeValue array (e.g material.nodeValue[0]).
If you have many Value nodes in your material you might also use material.nodeValueMap to resolve the index in the array by the node name (e.g material.nodeValue[material.nodeValueMap[“node_name”]])
2018-01-08 at 5:10 pm #1583donalffons
CustomerPerfect, thank you for you response! I will try it ASAP. By the way, it would be helpful if there was a documentation about the MeshNodeMaterial, mentioning this.
Thanks again!
-Sebastian -
AuthorPosts
- You must be logged in to reply to this topic.
