# Tag Info

22

A general outline: Create a depth map of your scene without the shield. You can get this effectively for free, since transparent objects are often rendered in a later pass anyway. Otherwise, you can create the depth map by rendering the scene sans shield onto an RTT with a depth shader. Render your scene normally, pass the depth map to your shield shader. ...

1

The robust solution is to build a frustum of planes symbolising the camera and check the plane against all of them. The first part involves creating the frustum which can be a bit tricky if you're lacking in basic linear algebra; Start with transposing the matrix you're using to transform from worldspace to projected space, the reason for this is because ...

2

I don't know which Engine, if any, you are using. Or which language you are working with. Still, most of what you can find online is not hard to port from one environment to the other to achieve what you are looking for. And there certainly is material online that can be of help to you. See this discussion related to Unity: ...

4

It's just using the depth map. It renders the world then renders the shield and takes a difference between the shield's rendered z value and the depth buffer z value to tint the pixel more white.

1

It's been a while since I've had to write code to do this, but here's how I used to do it, so I'm not going to write any code for this post, but I'm going to describe the theory in a way that hopefully sets you down the right path. You didn't mention whether their rotations changes at all during a single collision test, so I am going to assume they are not. ...

3

In the end, here it goes in detail the way I myself figured out to get what I've asked (also inspired by @snake5's comments): 1a) for each of the 12 edges (line-segments) of one box, we test first if it is entirely within the other box. If it is, we already save its both vertices in the final list of vertices that form the desired polyhedron. 1b) if it is ...

3

As you will easily find out, the most straight-forward solution is to run multiple times an algorithm that checks whether there is an intersection between the segment formed by Point1 and Point2 (let's call them p1 and p2) and the ones formed by each of the vertices of the rectangle (let's call them r1, r2, r3 and r4). A clean implementation ...

0

You can use the Line-Line intersection formula, Line-line intersection. If you consider a class Line class that is made up of two Vector2s you can calculate, using the above formula, the intersection between them. class Line { public Vector2 a; public Vector2 b; public Line(Vector2 a, Vector2 b) { this.a = a; this.b = b; } ...

0

Technically, you have a line expressed as a series of points. Then, you express the rectangle as bounded constraints. Then you would create sub-lines from the original lines by the bounded constraints. Depending on your own algorithm, this may have different effects, but this is the general idea.

0

One easy approach is: check intersection with each rectangle line. Here follow my lua code for that (Line line intersection) function getVec2(x_,y_) vec2={} vec2.x=x_ vec2.y=y_ function vec2:dist() --set relative position return math.sqrt(vec2.x*vec2.x + vec2.y*vec2.y) end function vec2:sqrdist() --set relative position ...

1

In an intersection, all of the surface planes involved form a new shape defined by these planes. To find the points, formally there's vertex enumeration. However, I find it easier to just skip all math theory and do 4 nested loops over the planes, intersection of the first two planes gives a straight line/ray, which is checked against the third to obtain a ...

Top 50 recent answers are included