How to only render part of a mesh
Blitz3D Forums/Blitz3D Programming/How to only render part of a mesh
| ||
Hi everyone, just wondering if anyone knows of a way to render part of a mesh? The reason being I need an entity to appear through a semi-transparent surface without being visible behind the surface, ala stargate etc. Thanks. |
| ||
You could do a multi-pass render and switch off z-buffer clearing with CameraClsMode. I've never done it and don't use Blitz3D any more so can't really offer an example I'm afraid, but I'm pretty sure it could be done in this way. |
| ||
Alternatively, you could clip the mesh, using this code: http://www.blitzbasic.com/codearcs/codearcs.php?code=1143 However, this does not work with animated meshes! |
| ||
Don't fancy doing any multipass renders as framerate tends to suffer too much. That code is exactly what I need, thanks big10p, it's a static mesh too so no probs there. Guess I should have checked the archives first.. |
| ||
Don't fancy doing any multipass renders as framerate tends to suffer too much. Shouldn't do - you're rendering the same amount of stuff, only you're doing it in two parts. |
| ||
Surely you have to do at least two renderworld() calls? or am I barking up the wrong tree? |
| ||
Big10P i'm surprised you never linked to the z-clip code, it was you who created it originally wasn't it? :) 'Fraid I don't have the link here. |
| ||
Big10P i'm surprised you never linked to the z-clip code, it was you who created it originally wasn't it? :) Er, I did! :) Or, are you talking about some other clipping code? |
| ||
I thought this new command would do something like that... Added MeshCullBox for manual mesh culling. This allows you to correct some situations where an animated mesh extends beyond the guesstimated bounding box. ...maybe it wasn't intended for this purpose exactly, but could be used for the same result? |
| ||
@Barliesque: Nope, not at all... Big10p,I was talking about the DirectX Clip Plane code :) |
| ||
Big10p,I was talking about the DirectX Clip Plane code :) Ah, right. I didn't do that - I think it might have been Tom. Not sure. :) |
| ||
The include I have has your name on it... :S will source it out later. Maybe I'm getting confused :) |
| ||
What's this about DX clip plane code?? sounds interesting. |
| ||
Not sure what's happened there - I know nowt about DirectX and haven't written a dll in my life. :) |
| ||
Rad, I will post a demo later. I beleive the main function behind it was written by Tom (That's a known fact as it uses DX7) however i was pretty certain the demo code I based my system off was by big10p lol. Apparently not :) |
| ||
Yeah, Tom wrote the clip-plane DX stuff, didn't he? I use it. It's very good. The thread author wants a far-side clip, though, and you can do that in B3D without resorting to a dll: Use a black* plane** to clip the object in question; copy the scene to a masked buffer; re-render with the object in question hidden; composite the masked buffer back over the scene; flip. EDIT: Like-a-this... *or whatever mask colour you prefer. **entityFX 1, mind. |
| ||
Don't worry big10, your code archive does the job nicely anyway! I do like the idea of accessing dx more directly where it's appropriate though. Cygnus, I'd be interested to see that demo. Sledge, good to know there's more than one way to skin the cat as it were. |
| ||
my little tech demo here demonstrates how to use Tom's DX7 code to split a mesh at rendertime. There's an include in there that you can use, at the moment it's got a credit to Big10p as his name was in the original one I modified lol... not sure how all that happened :) http://damientsturdy.pwp.blueyonder.co.uk/Craft.zip note: Copy the decls file to the blitz Decls folder for it to work. Also, It may have problems with Tom's latest DX7 dll. |
| ||
You can modify the mesh too. if not removing vertex one can just adjust em.. dont ask me how i never done it. |
| ||
Thanks for the demo cygnus, I may have to use this technique as, unfortunately, big10's algo works really well but is a little too resource intensive for my game (85fps drops to 40fps when using it). |
| ||
No prob. Thanks Tom and <unanimous> for the above :) (Will <Unanimous> come forward i wonder? :) |