Jump to content

How can I get the area where two objects intersect?


havenphillip
 Share

Recommended Posts

AABB and these commands are what I had in-mind.

virtual bool IntersectsPoint(const Vec3& p, const float radius=0);//lua
virtual bool IntersectsAABB(const AABB& aabb, const float overlap=0);//lua
virtual int IntersectsPlane(Plane plane);//lua
virtual bool IntersectsLine(const Vec3& p0, const Vec3& p1, const float radius=0.0);//lua
virtual float DistanceToPoint(const Vec3& point, const float radius=0);//lua

 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

An "AND" operation would be cool to have in the AABB class. I guess this could create a bounding box from the intersecting volume of two AABBs.

Boolean-Ven.jpg

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

What I really want is to make a plane on the ground and find all the objects that are intersecting it by the space they're occupying or the "hole" they're making in the plane. Ultimately I'm trying to develop a pixel depth offset effect like Unreal has but all their tutorials are using that goofyass node system. Some of them are doing this weird thing with that force field shader where they're using a depth buffer as a texture like "texture(depthbuffer, fragcoords);" What's the LE equivalent of that? Bounding boxes are probably good for finding the area but seems like a lot to do just to discard that space.

Link to comment
Share on other sites

If this is what you are trying to do, it looks to me like it is a combination of:

  • Apply a color when the Z component of the normal is near zero (edges).
  • Apply a color when underlying depth value is near the current draw Z position. It looks like a screenspace depth effect, which is why the effect is abruptly cut off on the left side of the box in the foreground.

shaderforcefieldsimple.png

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Man I'm always in over my head. Sounds like what you're saying is a fresnel and using the DepthToZPosition that is in your water shader with vec3 screencoord?

That's what I think I want. The problem I'm having is with the parallax shader. When I set things on it they look like they're floating above it. The rock highs and lows don't interact with like a box or tree model. So if you recall you can just cut the parallax texcoords and they appear to have a 3d "beyond the geometry" look. So if I can find all the intersections of items set on the parallaxed surface I can then discard those areas to give that impression on everything. UE's Pixel Depth Offset is the closest thing I've seen to accomplish this though I'm not entirely sure this is what they're actually doing. What approach do you recommend for solving that?

Link to comment
Share on other sites

You could manually write the pixel depth. Stalker did this for their shadowmaps. However this means you will lose early Z discard, which will make the shader more expensive.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...