havenphillip Posted July 23, 2020 Share Posted July 23, 2020 ...or where can I find out how to do this? What's the term I should look up? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted July 24, 2020 Share Posted July 24, 2020 You can detect if two objects collide with Collision but I don't think it'll give you the shape of the collision. Might be able to do it with Newton somehow. Quote Link to comment Share on other sites More sharing options...
reepblue Posted July 24, 2020 Share Posted July 24, 2020 Shaders or game code? I think there is a plane intersect function but not sure if it's exposed in Lua Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted July 24, 2020 Author Share Posted July 24, 2020 I was thinking shaders but I'm not entirely opposed to Lua if I could get it to work. I'm looking at the forcefield shader I keep seeing all around the internet. It draws a line where the two intersect. https://cyangamedev.wordpress.com/2019/09/04/forcefield-shader-breakdown/ Quote Link to comment Share on other sites More sharing options...
reepblue Posted July 24, 2020 Share Posted July 24, 2020 You could use aabb commands and convert the intersections to 2D space and pass the intersection points from the script to the shader. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted July 24, 2020 Author Share Posted July 24, 2020 You can pass things back from the script to the shader? Quote Link to comment Share on other sites More sharing options...
reepblue Posted July 24, 2020 Share Posted July 24, 2020 You should but I'm not sure if it's exposed to Lua. I can take a look at the headers tonight for you. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted July 24, 2020 Author Share Posted July 24, 2020 I just need to be pointed in the right direction is all. What's the term I should look up? Depth intersection? Something like that? Quote Link to comment Share on other sites More sharing options...
reepblue Posted July 25, 2020 Share Posted July 25, 2020 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 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted July 25, 2020 Author Share Posted July 25, 2020 Ok bounding boxes. Perfect. I'll start reading up on them. Quote Link to comment Share on other sites More sharing options...
Josh Posted July 25, 2020 Share Posted July 25, 2020 Depends on the object. For boxes, the math is pretty simple. Quote 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 More sharing options...
Josh Posted July 25, 2020 Share Posted July 25, 2020 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. 1 Quote 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 More sharing options...
havenphillip Posted July 25, 2020 Author Share Posted July 25, 2020 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. Quote Link to comment Share on other sites More sharing options...
Josh Posted July 25, 2020 Share Posted July 25, 2020 Render to texture and read the depth buffer in the shader? Quote 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 More sharing options...
Josh Posted July 25, 2020 Share Posted July 25, 2020 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. Quote 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 More sharing options...
havenphillip Posted July 26, 2020 Author Share Posted July 26, 2020 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? Quote Link to comment Share on other sites More sharing options...
Josh Posted July 26, 2020 Share Posted July 26, 2020 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. Quote 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 More sharing options...
havenphillip Posted July 26, 2020 Author Share Posted July 26, 2020 I don't suppose you have a snippet that shows how to do this? Quote Link to comment Share on other sites More sharing options...
Josh Posted July 26, 2020 Share Posted July 26, 2020 I think you just o this: gl_FragCoord.z = z position You might have to convert to a depth value. Quote 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 More sharing options...
havenphillip Posted July 26, 2020 Author Share Posted July 26, 2020 I'll keep trying. Thanks. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted July 27, 2020 Author Share Posted July 27, 2020 What about this? The foam around the rocks suggests to me that there is a way for the plane to "know" the shape of the things intersecting it. The question is what part of the shader knows that? http://fire-face.com/personal/water/ Quote Link to comment Share on other sites More sharing options...
Josh Posted July 27, 2020 Share Posted July 27, 2020 Same thing our water shader does. Quote 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 More sharing options...
havenphillip Posted July 27, 2020 Author Share Posted July 27, 2020 I've been meaning to pull the water shader apart to see how it works. I guess now is as good a time as any. Anything I should take note of specifically to get what I'm looking for like the fog or the amplitude or something? Quote Link to comment Share on other sites More sharing options...
Josh Posted July 28, 2020 Share Posted July 28, 2020 I think the shader compares the current depth to the stored one to control the transparency. 1 Quote 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 More sharing options...
Marcousik Posted July 28, 2020 Share Posted July 28, 2020 @havenphillip I (and for sure many others) would pay for such a water shader to use commercially if there was one in the marketplace... Maybe you could ask Shadmar to help with this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.