What a thoroughly awesome reply by Dino! I've NEVER.
For me it was like, more educational than that stuff I read from my Commodore 64 manual, and my DarkBasic manual(s). LOL! Pssh DarkBasic...
Quote:Original post by Dino
I would look into have a close representation 3D model of your 2D object that you can use to do all of your collision detections on. This close representation model can be rendered on a hidden surface with 0 frills and used for collision detection only. You can use the detailed 2D sprite for display, but use the 3D model for most of the grunt work.
Now THIS intrigues me! Because SHAME on a tad few other gamedev coders from my past 2 or 3 topics--I asked if this was possible to all of them and they said "Why not go all the way with 3d anyway," but I was like NAH, can't we make invisible polygon collision masks for my pixel art displays?!! They suggested billboarded sprites but I was hoping for something like this instead! Now I know it can be done! Thank the Lord. I have one solution down at last! Dino lit the fire. I didn't ask about this point in this topic here because I thought I would be beating a dead horse, I asked it like 4 times already. I must be smarter than I thought!
So this can be for any object, a tree, a rock, a monster, whatever? Because actually for the characters and monsters I was thinking that 3d rectangular bounding boxes would be fine in my game--but it will be a hack'n'slash, another nightmare to code I suppose, with all the weapon swinging/shooting. Would having polygonal collision boundaries save a mass more CPU power than voxel collisions, or just a small amount more?
The other thing is, the reason I really wanted pixel-perfect collisions is because I want objects to "roll" over rounded surfaces, instead of just cubic blocky heights or triangular ramp heights...I want organic hills. If there is a non-voxel collision method to get that, then awesome. Polygonal collision boundaries look like a good way to go. Someone at GarageGames told me that he's making an Isometric engine which will allow some kind of sub-cell collision checking within tiles I think...and they might be given height values too! I COULD probably ask him more about that.
Okay, now back to shadows baby!
So I was talking to guys at devmaster. One of them told me this:
-----"i think its possible, if you have absolute world coordinates for each pixel, which you could get from the base position of the sprite, then using the heightmap/coordinate map to create the exact world position of the pixel, you could use it to detect if its in shadow or not.
you could use geometry shadow volumes to do it.
you make the volume out of the outlines of the sprites (as long as you find its supposed exact 3d position) and extrude away from the light and then its
just a containment test per pixel to find out if its in shadow or not. (including ground tiles)"-----
I don't get the extrude part. BUT! I illustrated what I understand he meant by the world coordinates. So basically (correct me if I'm wrong) the world has absolute x and y values for each pixel right? Then, for objects' base pixels, x and y values are coded (absolute within the object, but relative to the world pixels?) and for any pixels in an object that supposedly have height, instead of coding their x and y values normally, we'd code say all pixels "above" x1y1, to be x1y1 as well! Then when a transparent shadow sprite crosses a world pixel, and an object's x1y1 pixel is sitting on that world pixel, THOSE pixels in the object which were coded as x1y1 will become shaded! Because the shadow will offset to those pixels! If that's confusing I drew my understanding here:
The first pink arrow shows an object pixel offsetting the cast shadow pixel.
The pink bracket in the 3rd diagram shows a row of pixels on that cubic object, which are all coded with the same x/y coordinates as the pixel at th base of the object, so they all get shaded by the cast shadow because it's as if it "moved" to all of them.
The last diagram has an unrealistic effect but for code purposes it has to be that way (if my understanding is right).
What we can get is that ramp-shading effect, where rounded and ramp objects can BEND cast shadows, as long as someone codes the heightmaps right?
So, how does this look for making pixel-precise cast shadows? I don't want a lighting system, just shadow sprites that follow objects and get cast over other objects, that's what I want. Does this take the same processing power as voxel collisions??
And, if I choose the polygonal collision checking method, would this kind of thing still be available?
Dino you rule!