hello, i am quite new to the unreal engine, and i encountered a problem: i want to access vertex color on a per-face basis ( to get the low poly look, flat look, or what ever you want to call it). I know that the most commonly used solution to this problem is splitting the vertexes (by smoothing groups, UVs etc.), but those methods multiply vert count, and limit rendering stripes length to 1 triangle so the’re not very optimal. But i know that in HLSL there is a way to set vertex color interpolation to “no interpolation”, so the color on the whole face is taken from value in it’s first vertex. I also know that its possible to write your own HLSL shaders in UE4, so in theory it should be posible to use this technique. Unfortunatly i couldn’t find any nice tutorials about this topic, and the unreal documentation about shader creation is not very detailed. So, could any of you, unreal masters, help me with this problem?
You probably don’t have to write your own complete shader for that. Instead just place the HLSL function for non-interpolated vertex color lookup inside a custom node and hook that up to the base color input of your material.
you mean “material expression custom” node? I dont know if i understand it correctly, but isn’t material graph letting you only create pixel shaders? i mean, isn’t interpolation happening in vertex shader? i thought that if i place vertex color node, it gives me already interpolated values, and if i would want to change the sampling method i would need to correctly define it in vs.
Currently modern engines only render indexed triangles. 2Triangle strips aren’t used. (These does not help for modern GPU’s)
I think there is no way within material editor to achieve interpolation mode “no interpolation.”
You’re right, I was a bit too quick with my previous reply. To fix that you can add customized UVs to your shader as their input is always evaluated in the vertex shader. You can then read from whatever you placed in these UVs and link that to the base color instead.