#How do i cull the unseen faces of a cube?

1 messages · Page 1 of 1 (latest)

vagrant siren
#

Making a simple minecraft clone and wanted to know how to cull unseen faces of a cube, maybe not render cubes that aren't there unless they are visible to the sky (i have no idea how to implement that either) I think thats a bevy agnostic question, so really i just need help not rendering entities that i have instanced

proven radish
#

"back face culling" is the term of art

vagrant siren
#

yeah that

#

i know what i need to do

#

just not how to do it in bevy

#

one id need to have some sort of chunk structure

#

with cubes inside

proven radish
#

Are you using the stock Bevy rendering or some sort of custom approach?

vagrant siren
#

stock bevy

proven radish
#

@hard quest might have some advice 🙂

vagrant siren
#

thats why im here

#

i honestly want to get the core gameplay of breaking and placing blocks before i go into chunks and random world gen

#

so i dont want to make this world generation thing too complicated

#

if theres an easy way to not render unseen faces then id prefer to go that way

hard quest
#

I think the default cube is going to have all 6 faces regardless of what's next to it
You can't really get far in a voxel game without some form of chunking, it's just too many entities

vagrant siren
#

ill try and figure it out

#

i just got one glitch where if a cube is beside another the overlapping faces tear a bit

#

i really just wanna hide those faces

vagrant siren
#

ive decided to hand make my own cube mesh but my program is panicking

#

so thats not good

#

heres the code i used to generate the mesh

#

from what i can see the error is in this file

#

using the backtracing

#

something is up with my positions it seems

#

nvm fixed it i formatted my stuff wrong

#

now i just need it to look like a cube

hard quest
#

Ideally you don't add the vertex data to the mesh at all if the face isn't visible

vagrant siren
#

its a little complicated and probably horribly inneficient

wary sapphire
#

There's blackface culling, but that doesn't help if meshes would occlude each other. For something Minecraft like, you'd want an entire custom rendering setup with chunked rendering and probably some custom culling.

hard quest
#

yeah you cull voxel faces that are touching

#

the tricky part is doing it across chunk borders