March 06, 2021, 02:44:09 AM

Author Topic: Strangeness  (Read 962 times)

Offline JBR

« on: May 01, 2020, 12:52:52 AM »

I was developing in open3d and hit a strange problem.

I'm using 3d lines, each a unique entity which goes around the craft.

Problem is when building the ship & lines (in a staggered way, one line per vsync). the frame rate reaches 200ms at worst. I'm finding open3d very strange behaviour.

So, I went back to minib3d and everything works as it should. Never more then 3ms all the time.

Only problem is my 3d line routine relies on AlignToVector and I've not found one which works in the same as the open3d one.

i.e. AlignToVector c3, x2-x1, y2-y1, z2-z1, 2

If you want the open3d code to show the slowdown vs the minib3d I'll zip up some files.

Anyone help?

Offline Matty

Re: Strangeness
« Reply #1 on: May 01, 2020, 01:36:09 AM »
If this is on a handheld device - the android garbage collector can cause stutter with some 3d engines.  Finding ways to overcome it can be interesting to say the least.

Just a guess.
I eat cheese in the trees when its eight degrees

Offline markcwm

Re: Strangeness
« Reply #2 on: May 01, 2020, 09:31:22 AM »
Yes, it's strange, I'll take a look at it if you post the files.

Offline JBR

Re: Strangeness
« Reply #3 on: May 01, 2020, 10:24:39 PM »

The 2 files are included.

Just tick the 4 boxes and download.

Thanks, Jim.

Offline JBR

Re: Strangeness
« Reply #4 on: May 01, 2020, 10:45:08 PM »
Here is an attached zip.

Offline angros47

Re: Strangeness
« Reply #5 on: May 02, 2020, 12:01:48 AM »
Actually, OpenB3D doesn't rely on a garbage collector (being written in C++), but it deallocates all the unused stuff as soon as possible. On the other hand, minib3d uses BlitzMax garbage collector (that actually might make things faster, at the price of some sudden slow-down when memory is full to deallocate everything at once)

Offline markcwm

Re: Strangeness
« Reply #6 on: May 03, 2020, 01:24:02 AM »
Thanks for the demo JBR, nice code! I get Openb3d going up to 800ms for about 30sec then it drops to 20ms and stays there, in Minib3d it's about 100ms all the time.

As Angros said, it's the difference in memory management, Openb3d is immediate so you get slowdowns until the memory is released, Minib3d is managed by the GC so you get steadier performance.

I'll see if I can find any AlignToVector code for Minib3d.

Offline TomToad

Re: Strangeness
« Reply #7 on: May 03, 2020, 12:50:56 PM »
I ran into the same problem with AlignToVector and miniB3D.  I did find an AlignToVector function
Problem with this function is that it only aligns the z axis.  Good if you are trying to point the camera in a particular direction, but if you need to align the x axis or y axis, then the function needs to be modified.  I tried to modify it, but couldn't get it to work for some reason.
8 rabbits equals 1 rabbyte.

Offline DruggedBunny

Re: Strangeness
« Reply #8 on: May 03, 2020, 03:30:14 PM »
Bear in mind Blitz3D itself is open-source and liberally-licensed (zlib/png), so this might help:

Offline JBR

Re: Strangeness
« Reply #9 on: May 03, 2020, 09:19:30 PM »

All the Turn code with quaternions was pinched from Krischans star code.

So he probably deserves the credit.

If you can come up with a working AlignToVector for minib3d it would be much appreciated.


Offline JBR

Got it working!!!!
« Reply #10 on: May 03, 2020, 11:54:24 PM »
I used the code by TomToad which only handles the z axis.

So firstly I make the scaled line along y, then rotatemesh c3,90,0,0 so it is pointing in the z axis.

Then I use TomToad's code and it works perfect.

My routine changes the scale of the line dynamically so rather then scaleentity c3,scale,1,scale I use scale,scale,1.

All fixed and many thanks. Jim.


SimplePortal 2.3.6 © 2008-2014, SimplePortal