#occlude near clip
1 messages · Page 1 of 1 (latest)
@peak canopy I appreciate the thought but please see above
If it doesn't work I can't ask for any help about it 🤷♀️
and with a code that complex I rather doubt it will
That aside, my partner would kill me for using any ai-generated code anyway
think of ai as the ice-breaker: it doesn't get you far but it gets you started. none of the code above is complicated but it's daunting to jump into it when none of its components are familiar. just jump into it and learn as you go
This is missing the point that answering questions with AI is against the rules of this community
I'm sure Amey!? is capable of asking ChatGPT herself if she wants to. She's asking here because she wants to tap into the knowledge of other humans. 🙂
(Also, screenshots of code are not very helpful!)
Sidenote that I'm reasonably sure ChatGPT is wrong anyway.
- Nothing will be nearer than the near plane.
- Only a few pixels will be at the near plane.
You may want to try a second material pass with a front-culling unshaded black material, if it is things intersecting the near plane you want to show the insides of as black.
It would be more tricky to show the silhouette of things which are wholly in front of the near plane, if that's what you mean.
This is part of why we ban using ai to answer questions ☝️ believe it or not it’s actually not helpful most of the time and the few times it does what you want it does them in a way that isn’t efficient
Thanks for providing a useful explanation haunty
This is exactly what I mean yeah!! Thank you for at least understanding that because it’s been hard to put into words.
I want to not only have the opposite side of the clipped mesh be black, I also want to not see the face of other meshes that intersect that one
drawing a black clip-shaped blob over the clip would be ideal
I'm afraid I don't think I understand this.
Is the camera orthographic?
In my original screenshot, here you can see a bit of the floor showing through the inside of this clipped vending machine
I want that bit of floor to also be hidden
Is that because of z-fighting? You might have to move the bottom of the vending machine up fractionally.
It is, and that would solve it, but I don’t want to have to do that manually for every instance of overlap, because sometimes my geometry is made of overlapping/intersecting shapes to begin with.
Maybe that’s just an unrealistic expectation but it sounds really easy in my head to just cover a clipped region with blackness
Unfortunately, I don't believe anything can tell the front of the vending machine is missing.
But the inside bottom of the vending machine might be able to do something.
Understood 🫡
if I can just set all the insides to be an entirely absorbent black, yea?
Easy on the face of it.
But the floor wins at random.
Annoyingly, this would be easy to fix in Unity. 
I have a fixed camera so this should be SOMEWHAT less of an issue for me.
I’m not at my workstation rn but I’ll try to do this
What I'd like to do is offset the inside pixels towards the camera slightly, so they'll win.
Oh, as for why I even want to do this
I want geometry that players can stand on to intersect the near plane and have a solid color at the intersection to make it obvious what is and isn’t “floor”
I would do that by just modifying DEPTH in the shader, but I can't just modify it - if it is set it has to be calculated from the start.
shader_type spatial;
render_mode cull_front, unshaded, world_vertex_coords;
void vertex() {
VERTEX += 0.0001 * CAMERA_DIRECTION_WORLD;
}
void fragment() {
ALBEDO = vec3(0);
}
This is working for me, as a second material pass shader.
Slightly moves the mesh towards the camera, which will usually move it past anything it is intersecting.
If it you move it too far, though...
Interesting! I’m going to have to mess with this a bit when I get back to my workstation 