Grid Custom Surface Projector
Last updated
Last updated
The Grid Custom Surface Projector component located in SoulGames > Easy Grid Builder Pro 2 > Scripts > Grid Custom Surface Camera Scripts dynamically adjusts the grid projection onto surfaces in real-time. This component is used to align grid visuals to underlying terrain or other complex geometry, ensuring the grid adapts smoothly to uneven surfaces.
This component is designed to work with the Custom Surface Grid Projector prefab, located in: SoulGames > Easy Grid Builder Pro 2 > Prefabs.
Update in Editor
Allows updates to projection while in the Unity Editor.
No
Main Camera
The camera used to calculate projection parameters. Defaults to Camera.main
if not assigned
Yes
Surface Layer Mask
Defines the layers used for detecting Custom Surfaces during raycasting (Ex: Terrain)
Yes
Minimum Projection Scale
The smallest scale for grid projection when close to the camera
Yes
Maximum Projection Scale
The largest scale for grid projection when far from the camera
Yes
Maximum Distance
The maximum distance to the Surface from the Camera for scaling calculations
Yes
Projection Depth
The depth of the decal projection
Yes
Decal Projector
The Unity Decal Projector component is used for grid visuals
Yes
Decal Camera
A secondary camera used for orthographic capturing of the grid
Yes
To use this feature, let’s say you want to project your grid system onto a Terrain.
Start by setting up your Terrain and Grid System. Position your grid system below the custom surface (Terrain). At this point, when viewed from above, the grid system should not be visible because it is positioned beneath the terrain.
Locate the Custom Surface Grid Projector prefab in: SoulGames > Easy Grid Builder Pro 2 > Prefabs. Drag and drop it into your scene. The projector will automatically find the Main Camera and configure the necessary parameters.
In the Custom Surface Grid Projector component, add the layers of your custom surfaces to the Surface Layer Mask property.
Ensure the Update In Editor property is enabled. This will instantly project the grid visuals onto the custom surface, allowing you to see the grid overlay on your terrain.
If the grid projection doesn’t cover the entire camera view area, you can adjust the Max Distance and Max Projection Scale properties. Be sure to test these adjustments in the Game view, not the Scene view, as the projection is designed to align with the camera’s view area.
In most cases, the default values work best, but fine-tuning these properties may be necessary for specific setups.
When you enter Play Mode and move the camera, you’ll notice that the projection dynamically adjusts to cover only the camera’s view area. This ensures optimized performance and maintains higher resolution for the grid visuals.
When you scale up the projection area using the Max Distance and Max Projection Scale properties, the projection area expands at the expense of projection resolution quality. It’s important to find a proper balance between area coverage and visual quality.
To enhance the grid’s appearance when using custom surface projection, it’s recommended to enable the Use Alpha Mask property in the Visual - Object Grid section of your Easy Grid Builder Pro XZ component. This limits the visible grid area, ensuring a cleaner and more focused projection.
Behind the scenes, a custom camera captures the grid surface and stores it in a Render Texture. This texture is then projected onto the custom surface using a Decal Projector.
You can find the Custom Surface Render Texture in: SoulGames > Easy Grid Builder Pro 2 > Misc Assets > Materials > Custom Surface Render Texture.
By default, the Size property of this texture is set to 2048 x 2048. You can adjust this value to fit your target platform, balancing resolution quality and performance.
One limitation of using custom surface projection is that the projected grid will not have any emissive qualities. If you’re using Grid Show Color HDR, the HDR emissive colors will not appear in the projected view. This is a trade-off for the performance and versatility of the projection system.