Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | pakchano | |
Old Version | Published before Godot 3 was released. |
I’m trying to modify the diffuse texture of a VideoPlayer and some Image textures through code, the inspector is not an option since I want to this dynamically.
Textures for both 2d and 3d objects, videos, and images should work the same according to the Godot Docs 2.1 (Texture).
This is what I have (works!):
var texture = player.get_video_texture()
# create a new fixed material
var material = FixedMaterial.new()
# assign the new texture
# TODO: add transparency to diffuse material
material.set_texture(FixedMaterial.PARAM_DIFFUSE, texture)
material.set_flag(Material.FLAG_UNSHADED, true)
# set the texture of the object to the new material
set_material_override(material)
Currently I’m setting a VideoTexture to a FixedMaterial and then adding it to my object. But, before setting the material/texture I would like to modify the opacity of the diffuse material to make the video see through.
Also if someone could explain what are the texture.set() functions for. And what are the available parameters, couldn’t find them anywhere.
Side note: Would be extremely helpful to update the documentation and make it more thoroughly for beginners. Can do it myself once this issue is solved.
Thank you kindly in advance,