SteamVR

SteamVR

SteamVR Workshop
Customize your SteamVR experience by finding new backgrounds, 3D environments, controllers and base station models.
Learn More
Praxeos1 4 11 Jul, 2019 @ 3:59pm
Vertex Paint/ Material Blending
There are some old tutorials on this that appear to be outdated. Is it still possible to blend materials in the current version of Hammer/Source 2? I'm working on my first outdoor environment. If I understand the vertex paint, it seems like a practical way to add variety to a large section of terrain, while preserving image resolution (i.e. I could rely on several tiled materials, instead of making a monstrous UV-mapped material for the whole landscape). I know how to create standard materials for Hammer, but have no idea how to set up materials for vertex painting. Any help would be appreciated.
< >
Showing 1-11 of 11 comments
Steve 11 Jul, 2019 @ 5:20pm 
It sure is possible, in your material enable the blend parameter, select how many blend types you want (none - 2-layer 3-layer). Most of the parameters are self explanatory.
Save the material, apply it to your surface in Hammer. Make sure the surface is suitably subdivided, next use the vertex paint tool to paint and blend layers.
Once you have painted an area in Hammer you can experiment with the parameters in the Material Editor to tweak the look.
Praxeos1 4 11 Jul, 2019 @ 7:30pm 
Thanks! I set up 2-layer, with "blend normals." I'm a little confused, however, because the 2-layer option has slots for three color maps. I have an un-numbered "base layer" and a layer 1, each with color, normal, and glossy. Then, there's a separate layer 2, that only has a color slot. The brush tool itself references channel 0 and 1, which appear to correspond to the un-numbered layer and layer 1. What purpose does the layer 2 color serve?

If I were to create a reveal mask, I assume it would be a gray-scale image and should probably reflect the contours of the base layer. So, for example, if I were to make a cobblestone road with a second layer of dirt and sand, I might set the crevices between the stones to a certain value to make the sand accumulate more there. Is that correct? If so, which value (black/white) corresponds to a higher reveal level?
Rectus 13 11 Jul, 2019 @ 11:34pm 
Looks like it might just be a bug in the editor. Layer 2 is used for the 3-layer blend mode.

The reveal mask works exactly as you describe it. Darker colors correspond to revealing the layer earlier. Here is an example for the cliffs in my ski slope.

https://i.imgur.com/GxvT7MW.jpg
https://i.imgur.com/9NHpce2.png
Last edited by Rectus; 11 Jul, 2019 @ 11:36pm
Praxeos1 4 12 Jul, 2019 @ 7:51am 
Perfect! Thank you.
Praxeos1 4 12 Jul, 2019 @ 7:57am 
By the way, did you subdivide the mountains in the ski slope all the way down to the max level? I'm hesitant to do so for my terrain, because of all the added polygons, but more gives much better control over the vertex paint. I suppose I could also selectively subdivide some faces more than others. As someone relatively new to all of this, I'm never sure where to draw the line on things like polygon count, texture resolution, etc.
Rectus 13 12 Jul, 2019 @ 8:43am 
I used a fairly low resolution mesh relatively to the size of the map, with the outer areas selectively reduced. You can press to Bake Subdivision button to make them into regular faces, so there is not really a proper max level.

https://i.imgur.com/f1gdp3A.png

SteamVR Home is designed to handle photogrammetry meshes with a polycount of millions though, so high res meshes shouldn't be an issue.
Last edited by Rectus; 12 Jul, 2019 @ 8:43am
Praxeos1 4 12 Jul, 2019 @ 9:01am 
Good point regarding the baked subdivision. I always assumed that the photogrammetry scenes could only get away with the high poly count because the lighting was baked, but now that I think about it, most have at least one in-game light source. The image of your mesh gives me a good starting point. I'll experiment with my subdivision in different areas and see what creates a fairly realistic vertex paint effect.
Rectus 13 12 Jul, 2019 @ 9:21am 
Note that my map takes the full default grid and available playspace, so it's enormous, and I still think I have a lot of budget left. A smaller map could likely get away with a lot highter polycount.

Not sure if polycount has much impact on using complex shaders. I'd imagine the number of pixels drawn on the screen is a bigger factor.

The main limiting factor on modern systems seem to be the number of draw calls. You can see the count in the Perf Stats window in Hammer, accessible from View->Toolbars. seems like Source 2 does at least one draw call per material per object, so using single materials on props and merging meshes using the same material (as long as it doesn't affect visibility) seems to be the way to go.

I just noticed that I had a ton of draw calls on the log cabin on the ski map. I had each log as a separate Hammer mesh, and merging the walls into one made it go from around 600 calls to about 120.
Praxeos1 4 12 Jul, 2019 @ 11:53am 
Regarding my comment about experimenting with the subdivision for the vertex paint, it doesn't change the resolution of the material, but more vertices makes it easier to smoothly follow the contours of the terrain with my additive material.

Merging meshes should really help with my map. A lot of my vegetation is made up of grouped modular meshes that each use the same material. But what did you mean by "as long as it doesn't affect visibility?" I right-clicked to merge some of my meshes. The engine recognized them as a single mesh, but I didn't see any physical change to the topology.
Rectus 13 12 Jul, 2019 @ 2:57pm 
I'm not sure how much it matters, but if you are in range of one part of a mesh, it's likely the entire mesh would be considered for rendering, so any visibility systems wouldn't do anything.
Praxeos1 4 12 Jul, 2019 @ 4:29pm 
Ah, yes. I understand now.
< >
Showing 1-11 of 11 comments
Per page: 1530 50