Gnollrunner Posted December 28, 2018 Share Posted December 28, 2018 So apparently I fist posted this in the wrong forum so let's try again .........I'm currently working on a planetary voxel engine (not like Minecraft but one that generates smooth terrain) . I've got it to the point where I it can generate planets at run-time via fractals (or other functions), it supports LOD with chunking, generates normals and it seems to have good performance. Currently I only have cursory wire frame graphics using Direct X 11. I would like to see if I can get it working with a game engine but I find most of them don't support double precision. To be more specific, I need it on the CPU side. I don't need or want it on the GPU. In addition I would also like to be able to use my own physics since the my engine currently drops everything directly into an octree so it kind of makes sense for me to do it. I'm wondering if Torque 3D can handle this or am I stuck with Direct X. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Happenstance Posted December 29, 2018 Share Posted December 29, 2018 Torque has support 64-bit datatypes (search for things like F64, Point3D, etc. in the code) but only certain parts of the engine make use of them by default. All object positions and rotations are stored and rendered using single precision floats. It wouldn't be impossible to convert these but be prepared for some pain if you go down that road. Quote Link to comment Share on other sites More sharing options...
Gnollrunner Posted December 29, 2018 Author Share Posted December 29, 2018 OK well thanks for the info. I'll search around a bit more but I'm a pretty competent programmer so if I can't find anything else I might consider it. Quote Link to comment Share on other sites More sharing options...
JeffR Posted December 29, 2018 Share Posted December 29, 2018 Honestly, the most common way to get around floating point precision issues with large open world/open universe simulations is to just recenter around the camera as the origin point.This way, as the camera moves zone to zone, it recenters as origin, and just has everything via an offset to keep the numbers more reasonable. I saw one planetary simulation engine do this via recentering on the nearest celestial body as you moved around.Any particular reason you have to roll with double precision? As @Happenstance said, the double precision capability is there via 64bit types, but nothing's really written around that for positional tracking purposes. Quote Link to comment Share on other sites More sharing options...
Gnollrunner Posted December 30, 2018 Author Share Posted December 30, 2018 That's what I do for the GPU and it's relatively easy, but on the CPU ..... well, I'm not saying it's impossible but It will certainly make things a royal pain in the ass for collision and just the fact I no longer have a uniform coordinate system. It's possible the extra stuff you would need to support it, would outweigh any performance gains you got from using single precision. I really don't see why I should suffer with this. I think it would be easier to just use Direct X or port an existing engine. Also as far as I know most people doing this kind of stuff are using double and custom engines so that tells me that it's probably the way I should go. Quote Link to comment Share on other sites More sharing options...
JeffR Posted December 30, 2018 Share Posted December 30, 2018 Yeah, I get what you mean about the uniform coordinate system.Well, if you did want to roll with the double precision positioning, the very first place you'll want to look at is SceneObject's transform matricies, like mObjToWorld and mWorldToObj and whatnot. They double-duty converting between local and world space, but mObjToWorld also is your general Transform.Those are all MatrixF, so you could either make a MatrixD class that uses doubles internally instead of floats and shift those transform matricies to that, or maybe just give a shot at making MatrixF use doubles as a whole. It'd definitely use more memory, but that may be a quick-and-lazy shortcut to at minimum testing the idea out.There'd be some other aspects that likely need dealing with, but that'd absolutely be your starting point with getting the positioning to be handled with doubles.This sort of thing has come up before in requests, so if you may some headway or find some useful tidbits relating to getting it to work I know other people would be interested in progress on it. 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.