Create basic specular texture through only material nodes?

I’d like to create a simple specular texture to show twinkles on a snow material. It’s for a landscape material, so i’d prefer to not use a actual texture if I can help it (as there are limited textures you can use per landscape component).

The specular I’m after just needs to be random white dots on a black background. Does anyone know if this is possible?

So if I understand correctly you’re basically looking for random noise generation. UE4 has a new node for this I believe but in UDK you’ll have to create the same logic yourself either with the Custom Material Expressions where you can enter the code directly or via regular Material Expressions. If you ask your favorite search tool about random noise generation in shaders you’ll find several resources like this: GPU Gems 2 Chapter 26. Implementing Improved Perlin Noise. Note they use textures but you don’t really have to, you should be able to access the arrays directly although you probably have to do the index computation as well (point filtering, clamp/wrap, no mipmaps). The input passed to the inoise function would be the World Position. Another great link is this GDC07 presentation: http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Tatarchuk-Noise%28GDC07-D3D_Day%29.pdf.

Those should be a good start. You could implement several of these as Material Functions so that you can quickly swap out the noise being used. Note that generating this may be more demanding than just a simple texture so you should be absolutely certain you can’t or don’t want to use a texture or can live with the potential performance impact. One thing to consider here would be to use the alpha channel of one of your textures you’re already using (assuming there is one that doesn’t use an alpha channel yet). You’d get this texture “for free” i.e. not using more textures for a specific landscape component.

So yes, it’s possible :slight_smile:

there was a thread in polycount long ago, where someone (Vailias probably) made/shared a noise function in the UDK material editor. however it was quite expensive
I would recommend using a noise texture, and sample/multiply several times at different scales

Does the snow material they use in the manual help?

Snow material

Thanks for the responses. I think the idea of using the alpha channels is a pretty decent. Currently all my landscape textures aren’t making use of their alpha channels.