Can anybody tell me how can I specify a Light vector with a blueprint? or specify using a point light to pass the light position and calculate the lightvector in material editor?
To do this you will need to create a blueprint to obtain the value, and pass it to the material.
First in the construction script create a Dynamic Material Instance, and save it to a variable like so (connect one of these to the Construction Script pin:
Then using that variable, you can set the light vector by creating a Vector Parameter in your material, one of these:
And from the Tick event in your blueprint, update the value with this setup:
EDIT: MID SKy should be your MatInstance, in case that wasn’t clear.
Let me know if you need any further info!
would be possible you pass the code node ?
For which node? The majority of the nodes above are custom to my setup, is there a particular one you can’t find?
The “Material” node is a variable of type Material
The “Mesh” node is a variable of type StaticMesh
and “MatInstance” is a variable of type MaterialInstance
The “SunLightSource” node is a variable of type DirectionalLight
I had a question, but I was able to solve. Thank you
Sorry but I new when it comes to BPs, but with this can I make a mesh have 2 different textures? one where light hits it and the parts in shadow, another texture?If so how do you go about that,thanks