English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. General (https://eab.abime.net/forumdisplay.php?f=37)
-   -   [C, RTG] My raycaster funtime.. sharing code, also looking for performance boost.. (https://eab.abime.net/showthread.php?t=106646)

mateusz_s 17 April 2021 23:48

[C, RTG] My raycaster funtime - sharing code and progress..
 
Source codes. Executables for Amiga and Windows.
https://github.com/mateusz83/msRay

--- UPDATE - 26.08.2022 ---

msDevPack v0.33 features:
- wall/floor/ceiling textures
- new, faster floor/ceiling render algorithm (based on screen projection and clipping)
- mipmaps (256x256 --> 32x32)
- baked lightmaps
- distance shading
- glowing pixels


video:
https://www.youtube.com/watch?v=mJMpln1JwvE


--- UPDATE - 05.07.2022 ---

msDevPack v0.32 features:
- wall/floor.ceiling textures
- mipmaps (256x256 --> 4x4)
- baked lightmaps
- distance shading
- glowing pixels

Test video (includes V1200 test):
https://www.youtube.com/watch?v=__vXgtkBG8c

Source code. Check out if you are interested in RTG coding,
Amiga framework, ReAction etc.:
https://github.com/mateusz83/msRay/t..._devpack_v0.32

Executables for testing:
http://mstanisz.website.pl/tmp/amiga/msRay-32.zip



--- UPDATE - 15.01.2022 ---

Hello again,
I send some time optimizing the engine and adding features.

Right now I have on V1200:
- 320x200x32 - average 50 fps, near the walls its 70-80 - generally its fast and smooth.
- 640x400x32 - average 16-18 fps (slowly but playable)

Check out demo level (this video is from WinUae)
https://www.youtube.com/watch?v=SH--b5G8BVc

Also check out how its working on Emu68 in INSANE resolutions :D
https://www.youtube.com/watch?v=QZwKZXet8oM

Checkout the exec yourself (needs RTG)
https://mstanisz.website.pl/tmp/amig...v0.31-exec.zip

The whole "devpack" with all sources (PC and Amiga, editor etc)
https://mstanisz.website.pl/tmp/amig...pack_v0.31.zip

The simplify "devpack" with Amiga sources only:
https://mstanisz.website.pl/tmp/amig...31--SIMPLE.zip



--- 17 April 2021, 23:48 ---


Hi,
Recently I spent some time to develop my Racycaster thinking mostly about Vampire accelerators. But the main point was to test the RTG possibilities and render something at 24 or 32 bits.

Right now, I get to this point (with 1:1 pixels)
- 320x240x32 - about 15-18 fps
- 640x480x32 - about 4-5 fps
on Vampires, the Warp 1260 at now is about 2-3x slower, but as far as I know the RTG is noy yest fully optimized

but please note that these are my coding limits not Vampire or Warp limits :)


VIDEO OF MY RECENT PROGRESS:
https://www.youtube.com/watch?v=u3zA2Wh0NB4


I was coding in C, I don't know assembler so I don't think I can optimize the speed any further by now.
But the engine like this should problably works on Vampire like at least 40-50 fps in 320x240x32 and maybe at least 20 in 640x480x32..
it was my first RTG and System Amiga coding attempt, I am glad of the results so far. I hope I will back soon to this project
and optimize it much better.

The textured walls itselfs with shading was very fast even in 640x480x32, but adding floors and ceiling slow donwn everything. They can't be so much optimized as walls.

I also wrote a Launcher that scans thru available display modes (in fullscreen or window) that can be filtered and formated by user.


NOTE!
I would like to share my code to encourage users and coders to use more RTG modes and higher resolutions or color depths.
I would like also to hear your opinion and maybe ideas to optimize the performance :spin:spin:spin
Probably the floor/ceiling is the major problem right now..


DOWNLOADS:
1. exec from the VIDEO: http://mstanisz.website.pl/tmp/amiga/ray8.zip
(works only on 32bit - fullscreen or window)

2. all C sources including Launcher application: http://mstanisz.website.pl/tmp/amiga/ray8-source.zip

3. C source with only main render loop to look up: http://mstanisz.website.pl/tmp/amiga...ender-loop.zip


KNOWLEDGE SOURCES
For people interested in Raycasting and graphisc programming I am sharing
some links:

1. probably the best Raycaster approach and tutorial: https://lodev.org/cgtutor/index.html

2. different Raycasting approach: https://permadi.com/1996/05/ray-cast...e-of-contents/

3. Watch 3 minutes of this clip first to get the idea: https://www.youtube.com/watch?v=gYRrGTC7GtA

4. wolf3d algorithm expalined: https://www.youtube.com/watch?v=eOCQfxRQ2pY

5. javidx9 (aka One Lone Coder) - yout tube channel - lots of inspirations and knowledge: https://www.youtube.com/channel/UC-y...UJZvieEligKBkA

6. Graphic Gems book series (I-V) lots of graphics algorithms

7. Pikuma Raycasting course - trigonometric approach: https://courses.pikuma.com/courses/raycasting-c

8. another channel with cg aspects coding: https://www.youtube.com/watch?v=0L2n8Tg2FwI

9. and another yt channel: https://www.youtube.com/user/Bisqwit

Photon 21 April 2021 19:40

In rendering, a Profiling method is gold for optimizing Fillrate. Some portions can get close to memory bus bandwidth (staring into a wall), per-pixel operations scale quadratically with resolution (big room with few walls).

I'm sure you know some culprits already, I'm stressing this because the more you know about the slowest rendering code, the more frame time you can remove. Measure frame times accurately, and improve low FPS outliers as first priority; ignore average FPS until you've addressed the major time sinks, removing as many per-pixel operations as you can.

Profiling gives insight into relative performance. Regarding absolute FPS expectations: A 486DX2-66 MHz "struggles a bit" clip (usually means ~30 FPS) @ ~256x140x8bpp (with enemies, shots, score, damage, etc). An 060 is faster per MHz if utilized properly. More information about the systems you run your code on is required to draw conclusions about code performance vs ideal (or close-to-ideal) hardware performance.

Pyromania 22 April 2021 13:55

@mateusz_s

Thanx, looks like cool stuff and sounds like fun.

NovaCoder 22 April 2021 14:44

Very cool stuff like I said to you before, well done.....must have been a huge coding effort.

High color RTG graphics on a real classic Amiga will never be that fast I'm afraid to say, even discounting the fact the the CyberGFX API probably isn't very well optimized for high color the Zorro bus throughput is very limited so it will have trouble just drawing a screen quickly. Obviously FPGA computers like the Vampire won't have this limitation.

Profiling C (or even C++) would be very helpful for the classic Amiga but as far as I know this isn't possible using gcc?

mateusz_s 23 April 2021 23:06

Quote:

Originally Posted by NovaCoder (Post 1478554)
Very cool stuff like I said to you before, well done.....must have been a huge coding effort.

High color RTG graphics on a real classic Amiga will never be that fast I'm afraid to say, even discounting the fact the the CyberGFX API probably isn't very well optimized for high color the Zorro bus throughput is very limited so it will have trouble just drawing a screen quickly. Obviously FPGA computers like the Vampire won't have this limitation.

Profiling C (or even C++) would be very helpful for the classic Amiga but as far as I know this isn't possible using gcc?


Hello NovaCoder, thanks you for reply..
Well yes, I am aiming for "modernish" accelerators like Vampires with combined RTG..
This because, there are a lots of 8 bit fps and other games, I just wanted to step level up,
and see the new possibilities.

This code can be much more optimised, and almost for sure could run 40-50 fps in 320x240x32.. which is more than enough. ~20fps in 640x400 could also be possible which is playable.

You can use profiler on GCC.. it generates the output file.. but in my case I couln'd find it much useful..

Another possibility is to use cycle counter and cache misses counter, but on Vampire only.

But 32 bit color is not only for 3d games that need lots of calculations. For example for a nice Tower Defense game we don't need 32bit, 8 would be enogh, but in higher resolution etc.

Anyway I am still trying to make more optimalisations, working in C, optimizing loops, trying different rendering algorithms etc.. no pressure just fun..:spin:spin:spin

mateusz_s 15 January 2022 16:54

(THE FIRST POST HAS BEEN UPDATED)


Hello again,
I spend some time optimizing the engine and adding features.

Right now I have on V1200:
- 320x200x32 - average 50 fps, near the walls its 70-80 - generally its fast and smooth.
- 640x400x32 - average 16-18 fps (slowly but playable)

Check out demo level (this video is from WinUae)
https://www.youtube.com/watch?v=SH--b5G8BVc

Also check out how its working on Emu68 in INSANE resolutions :D
https://www.youtube.com/watch?v=QZwKZXet8oM

Checkout the exec yourself (needs RTG)
https://mstanisz.website.pl/tmp/amig...v0.31-exec.zip

The whole "devpack" with all sources (PC and Amiga, editor etc)
https://mstanisz.website.pl/tmp/amig...pack_v0.31.zip

The simplify "devpack" with Amiga sources only:
https://mstanisz.website.pl/tmp/amig...31--SIMPLE.zip

Aardvark 15 January 2022 21:38

Tested this on TF1260 100mhz+Radeon https://youtu.be/bn8e3Q-wK3g No idea whats up with the colors.

kriz 15 January 2022 21:48

Really impressing speed!!

mateusz_s 15 January 2022 23:18

Quote:

Originally Posted by Aardvark (Post 1527202)
Tested this on TF1260 100mhz+Radeon https://youtu.be/bn8e3Q-wK3g No idea whats up with the colors.

Hi thanks for testing.. nice speed and interesting config. I am glad its fast on TF1260. I don't know right know why some colors are wrong, I run on BGR mode on winuae but it was ok..

mateusz_s 02 February 2022 18:54

All shading variants, with lightmaps:

https://www.youtube.com/watch?v=F5gbjdYLSuI

mateusz_s 05 July 2022 22:10

Hello, check out the latest update..

--- UPDATE - 05.07.2022 ---

msDevPack 3.2 features:
- wall/floor.ceiling textures
- mipmaps (256x256 --> 4x4)
- baked lightmaps
- distance shading
- glowing pixels

Test video (includes V1200 test):
https://www.youtube.com/watch?v=__vXgtkBG8c

Source code. Check out if you are interested in RTG coding,
Amiga framework, ReAction etc.:
https://github.com/mateusz83/msRay/t..._devpack_v0.32

Executables for testing:
http://mstanisz.website.pl/tmp/amiga/msRay-32.zip

mateusz_s 26 August 2022 22:40

--- UPDATE - 26.08.2022 ---

msDevPack v0.33 features:
- wall/floor/ceiling textures
- new, faster floor/ceiling render algorithm (based on screen projection and clipping)
- mipmaps (256x256 --> 32x32)
- baked lightmaps
- distance shading
- glowing pixels

Source codes. Executables for Amiga and Windows.
https://github.com/mateusz83/msRay

video:
https://www.youtube.com/watch?v=mJMpln1JwvE

This is probalby the fastest results I have ever made.
- on V1200 35-45 fps
- on Warp1260 19-21 fps

switching off the lightmaps would gain the performance much more

Dunny 27 August 2022 14:29

oh cool! I did something like that in BASIC!

https://www.youtube.com/watch?v=kfLqmCxzs9E

Excuse poor recording software, it was some years ago now.

modrobert 28 August 2022 11:26

Quote:

Originally Posted by Dunny (Post 1561633)
oh cool! I did something like that in BASIC!

https://www.youtube.com/watch?v=kfLqmCxzs9E

Excuse poor recording software, it was some years ago now.


What BASIC is that and what hardware is it running on? Looks pretty fast.

mateusz_s 19 April 2023 00:19

--- Probably the last update ---

msRay 036 features:
- regular / non regular walls, oblique / different height
- doors - regular, non regular, oblique, open up or to sides.
- wall/door collisions
- status bar (autoscaled to width)
- lightmaps
- glowing pixels (not affected by shadows)
- RTG or HAM8 modes

min config: 040/060 AGA
recommend config: fast 060 RTG

source codes avaialb on git hub:
https://github.com/mateusz83/msRay

Link to EXE:
http://mstanisz.website.pl/tmp/amiga/msRay_036.zip


https://www.youtube.com/watch?v=wv3OYbADkJQ

https://www.youtube.com/watch?v=v5oOLcYEvoM

https://www.youtube.com/watch?v=iEUx0xVAae0

https://www.youtube.com/watch?v=q8jkLqvP4ZQ

Karlos 19 April 2023 10:35

That's a good looking raycaster.

I was going to ask if the lightmaps get prebaked, then I saw the door open while the apparent lightmap remained in the same place (as you would expect for an object moving through a shadow volume). Excellent stuff.

pixie 19 April 2023 12:00

I could see Alien Breed on this engine! ^^

Karlos 19 April 2023 12:06

I'm not sure. Raycasting comes with some limitations that restrict level design.

Reynolds 19 April 2023 12:11

This is cool. Keep up the great work!

pixie 19 April 2023 12:19

Quote:

Originally Posted by Karlos (Post 1610390)
I'm not sure. Raycasting comes with some limitations that restrict level design.

I guess... but there was something about the lighting that made me feel like home


All times are GMT +2. The time now is 18:08.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04822 seconds with 11 queries