flat assembler
Message board for the users of flat assembler.

Index > Windows > Ray marching distance fields in real-time on the CPU

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 28 Apr 2015, 18:54
Hi,

I have implemented program that renders simple 3D scene in real-time on the CPU. Program requires CPU with AVX2 and FMA3 instruction sets support (Haswell and newer).
It takes about 25 ms to render one frame on Haswell i7 (40 FPS).

Screenshot and code attached.


Description:
Filesize: 152.42 KB
Viewed: 12354 Time(s)

spheres.png


Description:
Download
Filename: sphere.zip
Filesize: 12.36 KB
Downloaded: 508 Time(s)



Last edited by randall on 13 Aug 2015, 09:49; edited 2 times in total
Post 28 Apr 2015, 18:54
View user's profile Send private message Visit poster's website Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 767
tthsqe 29 Apr 2015, 01:39
Very nice - i get 16fps on my dual core HT lappy.
Post 29 Apr 2015, 01:39
View user's profile Send private message Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 29 Apr 2015, 06:54
tthsqe wrote:
Very nice - i get 16fps on my dual core HT lappy.


Thanks tthsqe. The next step is to render Quaternion Julia Sets.
And my longer term plan is to implement path tracing and render fractals with global illumination (not in real-time of course).

Can I ask what are you working on currently?

BTW, your Mandelbox is amazing and motivates me to work harder on my own stuff Smile
Post 29 Apr 2015, 06:54
View user's profile Send private message Visit poster's website Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 353
Location: Poland
macgub 29 Apr 2015, 07:46
Unhappily my cpu don't support AVX2 and FMA3. I'm sad. Crying or Very sad
Post 29 Apr 2015, 07:46
View user's profile Send private message Visit poster's website Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 767
tthsqe 07 May 2015, 18:12
Code:
Can I ask what are you working on currently?     


No much - I am too lazy these days to do too much programming. I am slowly building a chess gui+engine. Would you like to see the code for the program that made those movies?
Post 07 May 2015, 18:12
View user's profile Send private message Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 08 May 2015, 08:21
tthsqe wrote:
Would you like to see the code for the program that made those movies?


Yes, sure.
Post 08 May 2015, 08:21
View user's profile Send private message Visit poster's website Reply with quote
80286



Joined: 01 May 2015
Posts: 15
80286 08 May 2015, 10:18
macgub wrote:
Unhappily my cpu don't support AVX2 and FMA3. I'm sad. Crying or Very sad

I don't know wether my CPU supports them or not.
qjulia.asm compiles without errors using FASM 1.71.39, but if I try to run it it crashes.
Win8.1, Pentium Dual-Core E5300@2.6GHz 1.6 Ghz, 4GiB installed RAM
Post 08 May 2015, 10:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20619
Location: In your JS exploiting you and your system
revolution 08 May 2015, 10:23
80286 wrote:
macgub wrote:
Unhappily my cpu don't support AVX2 and FMA3. I'm sad. Crying or Very sad

I don't know wether my CPU supports them or not.
qjulia.asm compiles without errors using FASM 1.71.39, but if I try to run it it crashes.
Win8.1, Pentium Dual-Core E5300@2.6GHz 1.6 Ghz, 4GiB installed RAM
It does not.

When fasm compiles it doesn't use any instructions beyond 80386. So fasm can always compile even the newest instructions as long as your CPU is 80386 or later.
Post 08 May 2015, 10:23
View user's profile Send private message Visit poster's website Reply with quote
80286



Joined: 01 May 2015
Posts: 15
80286 08 May 2015, 11:11
revolution wrote:
It does not

Thanks for clearing that. I am preparing to get an actual PC who can use those instruction sets.
Post 08 May 2015, 11:11
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 767
tthsqe 27 Jul 2015, 05:05
I am adding the mandelbox code to github. It is probably incomplete and some of the comments might be wrong, Laughing
but you can compare how I did some things.
https://github.com/tthsqe12/mandelbox

I'm currently working on some dense algorithmic programs and have switched to c++ now that I have understood that compiler. I hope this board doesn't view me as a traitor.
Post 27 Jul 2015, 05:05
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 27 Jul 2015, 12:53
Yup. Crashes here too. Something isn't supported I guess.

Win7 Ultimate 9GB RAM
Post 27 Jul 2015, 12:53
View user's profile Send private message Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 28 Jul 2015, 19:59
tthsqe wrote:
I am adding the mandelbox code to github. It is probably incomplete and some of the comments might be wrong, Laughing
but you can compare how I did some things.
https://github.com/tthsqe12/mandelbox

I'm currently working on some dense algorithmic programs and have switched to c++ now that I have understood that compiler. I hope this board doesn't view me as a traitor.


Thanks for the info.
I'm currently working on distance field rendering in C++ and DX12. GPUs are so much faster for this kind of stuff...
Post 28 Jul 2015, 19:59
View user's profile Send private message Visit poster's website Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 28 Jul 2015, 20:02
typedef wrote:
Yup. Crashes here too. Something isn't supported I guess.

Win7 Ultimate 9GB RAM


Program requires CPU with AVX2 and FMA3 instruction sets support (Haswell and newer).
Post 28 Jul 2015, 20:02
View user's profile Send private message Visit poster's website Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng 29 Jul 2015, 00:49
Hi, Randall:
It's very cool, but it will crash in my win7 64bit os. it seem that the WIN64 program need align the stack address to quard word align before executed call instruction. You only added align instuction into the source code, but it only work in complier time, it can't sure that it's okay in the run time . So it will crash sometimes in WIN7 64bit OS.

Thanks.

Kenneth Zheng

_________________
Pure Assembly Language Funs
Post 29 Jul 2015, 00:49
View user's profile Send private message MSN Messenger Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 29 Jul 2015, 10:30
Kevin_Zheng wrote:
Hi, Randall:
It's very cool, but it will crash in my win7 64bit os. it seem that the WIN64 program need align the stack address to quard word align before executed call instruction. You only added align instuction into the source code, but it only work in complier time, it can't sure that it's okay in the run time . So it will crash sometimes in WIN7 64bit OS.

Thanks.

Kenneth Zheng


rsp alingment is ok (I'm keeping it aligned all the time by substracting aproperiate valu from rsp register).

What CPU do you have?
Post 29 Jul 2015, 10:30
View user's profile Send private message Visit poster's website Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng 29 Jul 2015, 14:52
Hi, Randall:
The CPU type is the Intel Core I7-5500U CPU @2.4GHZ.

Thanks.

Kenneth Zheng

_________________
Pure Assembly Language Funs
Post 29 Jul 2015, 14:52
View user's profile Send private message MSN Messenger Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 29 Jul 2015, 19:56
Kevin_Zheng wrote:
Hi, Randall:
The CPU type is the Intel Core I7-5500U CPU @2.4GHZ.

Thanks.

Kenneth Zheng


Windows fails to create 8 threads on the machine without HT (in this particular case). Try to change k_thrd_count to 4.
Post 29 Jul 2015, 19:56
View user's profile Send private message Visit poster's website Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng 29 Jul 2015, 23:57
Quote:

Randa Wrote:
Windows fails to create 8 threads on the machine without HT (in this particular case). Try to change k_thrd_count to 4.


Hi, Randall:
Yes, you are right, when I change the k_thrd_count from 8 to 4, it worked normally in win7 64 BIT OS.

Thanks.

Kenneth Zheng

_________________
Pure Assembly Language Funs
Post 29 Jul 2015, 23:57
View user's profile Send private message MSN Messenger Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 13 Aug 2015, 09:53
I have uploaded new version that:

* Displays error message when AVX2, FMA extensions are not supported.
* Creates X threads where X is equal to the number of logical processors present on the machine.

Thanks,
Michal
Post 13 Aug 2015, 09:53
View user's profile Send private message Visit poster's website Reply with quote
randall



Joined: 03 Dec 2011
Posts: 155
Location: Poland
randall 13 Aug 2015, 10:04
Kenneth Zheng,

How many FPS do you get on your machine?

Thanks.
Post 13 Aug 2015, 10:04
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.