Jump to content
Sign in to follow this  

UE4 and Blender - BSP style is a must

Recommended Posts

3 hours ago, blackdog said:

Oh I do understand what you say, the whole problem sounds pretty intuitive… what I don’t get is why is a problem in the first place. From what @Klems was writing it seems it’s a legacy issue that always existed, so i imagine there must be some article talking about this?

The below text is from a citation in that wiki link I posted you, and opens the section of code in the Q3 code that solves the square root of calculating a 32-bit floating point number:

long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration

// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed

What I guess 2DChris was saying is that this problem cannot be solved without brute force in real time without massive overhead, unless that hexadecimal (0x5f3759df) is used. What I'm getting at is very simple: I don't care about this when building. It's 2018 and all game engines can have editing without it as they work in a pre-runtime universe.

Share this post

Link to post
Share on other sites
2 hours ago, leplubodeslapin said:

I don't get why you think those coordinates use irrational numbers, it's just decimal numbers with plenty of significant digits. They don't get rounded because of fast algorithms like the fast inverse square root (which I assume is more related to the rendering) that aren't perfect but gives the opportunity to manipulate complex geometry.

It's important to understand how accurate your result is if a rotation has an angle of "15.00000154121254884516515465449" , you'll need to make that rotate thousands of times in a row before slightly noticing an offset visually.

I think I see your point. Perhaps it is an irrational number, perhaps not. But it is not precise when working with a grid and if a level editor is using BSP or a polygon modelling tool, can create a knock on effect.

Drop a cube into a level, knock out the interior space to make a house, add a roof, door, windows etc and before you know it, even though you are working to a grid, you got problems. Then you create a fabrication to make a row of houses and oh boy, look where we are heading.

Share this post

Link to post
Share on other sites

Interesting thread. I can give a bit of information on this.

Floating point precision issues tend to occur after repeated math operations on a float. I don't think float precision would be causing issues directly when using the grid because I would assume that when you snap to the grid it sets the position to some integer coordinate and then casts to a float which locks it into a form that a float can represent without issues.

It's been a while since I've used the unreal engine but I'm going to a new job soon where I will be using it so I'm looking forward to getting back into the engine source code.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this