How do i make this material fake light material work in ISM as its working in Static Mesh. Video and Project:

Hello fellow unreal devs,
Its been a while since i last posted here.

Im having trouble making this material work…
I tried everything now.

It works perfectly in Static Meshes but it doesnt work in ISM.

Basically it simulates this shiny effect by doing Dot product with the normal texture and a Vector
location that is supposed to be the source light.

Two different static meshes, you can see that as i rotate them, their shininess rotates. Thats how its supposed to be.

But when i try this on an ISM, it wont work because, the ISM are not individual meshes.
So when i rotate the Instances of the ISM it stays the same, because it seems the ISM has one global central position in the material.

Though there’s a way to get each specific instance position in the material, using the Object Position and vertex interpolator as you can see in the video, I havent been able to make it work with it.

How do i make it work for the ISM as its working for the Static Mesh?

Pls help.

Test_Shiny_Squares.rar (1.8 MB)

1 Like

I think it should work for ISM, just not HISM. No?.. :thinking:

1 Like

I tried both. ISM doesnt work either.

1 Like

https://us.edu.com/d/3245-top-play-to-earn-games-in-2023/3

Hi, try subtracting “ObjectPivotPoint” from the LightVector rather than using the Transform World to Local - that should work for both ISM and HISM in 4.27.

1 Like

Ah, no, you’re right… :confused:

Local position works, apparently

It might be possible to calculate the normal using that, and something like this

( good luck :slight_smile: )

1 Like

thanks though Object Pivot Point will not give the location of each instance instead it will give the same global location for the ISM for all its instances.

To get the location of each instance both Object Position + Vertex Interpolator, or Local Position as mentioned by @ClockworkOcean work. Though whatever math i apply to it doesnt work.

Is there perhaps another way to apply a fake white highlight that stays in the same corner of the rectangle when you rotate it? Maybe this is never going to work, and there’s some other way?

What i need is basically just a white circle / dot shining that stays in the same direction → as the mesh rotates (like light would do)

Component pivot point is per instance. Alternatively, you can take (0,0,0) and transform it from instance and particle space to world space.

2 Likes

hmm - try changing the Transform to “Tangent Space->World Space”:

1 Like

omg. this solved it. thanks so much.
I was about to just make a sprite in photoshop with highlights, but if i did it that way the sprite would not change lights if rotated.

Though why is the tangent space working?
Does it relate to the instances?

1 Like

No problem :slight_smile:

Yes, the instances don’t like local space - at least in 4.27, UE5 has a lot more support for per-instance transforms.

The ISM/HISM Component can kind of be thought of as a single mesh containing lots of the instance mesh. As far as the engine is concerned, the raw information passed through to shaders is the bounds of the entire collection of instances and the pivot is the Components location.

All the material nodes that have the correct per-instance data have been worked to pass through the extra information to make it look like an individual object.

1 Like

I love instanced static meshes. I think they are so cool.
Its one of the things i like the most in unreal engine.
thanks

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.