Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Marigold Fleur

Member Since 19 Dec 2011
Offline Last Active Private

Topics I've Started

Using precomputed stencil volumes and Carmack's Reverse for hole rendering

23 August 2014 - 08:25 PM

DISCLAIMER: I'm using Unity, but I just need the theory here, really. As a warning on the Unity player, there's no invisible walls, so please don't fly off the edge of the world.

 

Unity player link

 

I've been trying to use precomputed stencil volumes like spheres, boxes, and cylinders to render holes in meshes, but I'm having a bit of trouble. The big problem is that I've actually never coded stencil shaders before and usually use visual shader tools like the UE4/UDK material editor and Shader Forge, but those aren't an option for this project.

 

I'd like to accomplish something like in the Unity player there where I'm cutting a spherical (or other geometric) volume out of the level geometry. It seems to me that I should be able to use something like Carmack's reverse for this and just have it so that instead of calculating the shadowed areas, I'm calculating an alpha clip on the intersected geometry. Because I'm on Unity Free, I don't have access to things like render textures, but I do have access to the stencil buffer, which should make this theoretically possible.

 

I think.

 

...help


Problems projecting a hex map across varied terrain

19 December 2011 - 12:16 PM

Posted Image


Pictured above is what I am trying to accomplish. I'm projecting a hexagon grid onto some terrain using Unity's blob light projector preset. I'm trying to do this so that if you view the map from directly above, you still have a perfect hex map, even if the terrain has variation on it. It works great, to an extent.

Posted Image


It deforms nicely, but when I try and deform the terrain, it stops projecting across the whole terrain and instead limits it to the blob size.

Posted Image


Leaving me with an incredibly sparse terrain. Since blobs don't support proper tiling, what do I do here? Do I just have the game automatically generate and space out blobs?

PARTNERS