CSG Problems
Blitz3D Forums/Blitz3D Programming/CSG Problems
| ||
All, I'm using the CSG code from the Code Archives here: http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=560 But I'm getting little sparklies along the seams of my polygons. I (think I) understand that this is due to some floating point innacuracy when the new mesh is built, i.e. the edges of the polygons are very very very slightly out from where they should be. Can anyone help to fix this? I will be totally honest and say that I don't really understand CSG and I admit that I am "standing on the shoulders of giants" as it were to accomplish my goals! Cheers, Ryan |
| ||
Yes, maybe these gaps are there because of FLoating Point inaccuracies. However, you could fix this with a weld function. Just for the case: A weld function will round the xyz position of each Vertex eg. to a value that can be divided trough 0.1 or whatever. It could then remove double Vertices and rebuild the mesh based on the remaining vertices, but this step might not be neccessary. |
| ||
jfk, Like this function from the code archives: http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=454 ??????? Cheers, Ryan |
| ||
Yes, of course, you can use an existing Weld function. Depends on your need for unshared vertices. I just explained it cause I wasn't not sure how familar you are with 3d, no offence :) |
| ||
You said in another thread that you were using this to make the holes in your golf game. But I'm curious... Would it not be easier for you to draw a black circle on a sprite, align it to a terrain (with aligntovector), and check for sphere-to-sphere collisions between that and the ball? If they collide, you can gradually move the ball towards the centre (X/Z axes) of the hole, then move it down the Y axis so it appears to drop into the hole. That's how I'd do it anyway. Saves messing up your landscape geometry. |
| ||
Indeed, making round holes creates a high number of Polygons. |
| ||
GfK, Yes, I'm considering using that method now, I just thought it would be nicer to have a "real" hole! jfk, My courses are very low-poly anyway! Doesn't affect the look of them too badly and keeps the datafiles used nice 'n' small for downloading. Cheers, Ryan |