Raytracing in Blitz3d - example code and image inside

Started by Matty, January 12, 2025, 14:54:20

Previous topic - Next topic

Matty

An edited rendered video using the raytracing technique.

Code available to look at and play with on my itch site under 'solar conflict'....though it's an addon, not part of the regular game code so you will need to make some changes if you decide to run it. (add a folder marked 'render', add explosion images from my explosion store page...or just change the explosion sprites in the source code)


Matty

And two interior shots, same rendering raytracing method...
1 Light Source (soft shadows switched off)
Only diffuse lighting
No specular map, no bump map, no illumination map. (not yet anyway)



Matty


And this is the real time version of the game using standard directx vertex lighting.


RemiD

for the directx lighting shading version,
your spaceships would look much better with some reflections effect (with precaptured cubemap textures, of the static environment)

you can decrease the intensity of the reflections by puting a black quad in front of the camera, before the capture, and increase decrease the quad alpha to find the right intensity.

i can post a code example if you want...

a thread about that : 
https://www.syntaxbomb.com/blitz2d-blitzplus-blitz3d/some-notes-about-reflections-of-the-environment-using-cubemap-textures/

Matty

Thanks RemiD....I've started playing around with the Raylib library using C# just to get a feel for it. This is the result after two days work: (realtime rendering)


Matty

#20
A bit further along with Raylib....

You can try out the game so far (it's more a simulation) on my itch page matty77.itch.io - it's one of the downloadable files on the Raytraced Space Combat game page.

xper

Derron

What are your first impressions with raylib ? Does it offer an easier access to everything compared to Blitz3d? What about the performance (on your computer) ?



bye
Ron

Matty

First impressions.....

Well it sat around on my computer for years without me ever touching it because I couldn't face learning a new tool. But...upon doing so - 

It lacks some of Blitz3d's ease of use. But at the same time it is both more and less powerful than Blitz3d. With shaders you can do a lot more, and the performance is much better than Blitz3d in terms of number of meshes combined with the lighting models you can build for them.

But...it has severe lack in the area of animated meshes. The file formats it loads are mainly static files, and the only animated models it can load aren't easily accessible with any tools that are around today.

I'm using the C# version of it.

It can't be that difficult a package to learn - you can see how far I've come in just three days. 

I would say it's not a beginner's tool, compared to Blitz3d - you do have to have some understanding of mathematics just to get simple models to rotate and so on (and thankfully I do). Blitz3d - you can tell a camera where to go and what to point at or turn to with some simple commands. You have to have an understanding of vectors and matrices to be able to make full use of the camera commands in Raylib.

It's more modern than Blitz and I like it, but it does lack support for certain things that I'll end up having to build myself if I want to do it.

Matty


Derron

Video looks nice - even has a flying white cube (I did not miss it :P).
It looks as if it renders smooth enough at your computer.

i think "raylib"  might not offer this "rotate entity" thing in a certain manner as it is a ... lib - not a "game framework". But never checked.
So yeah, you might have more control .. but need to know what you control - and how to control it.

QuoteRaylib is designed first and foremost as a library to help people get into gamedev and learn how lower level systems are made. As has been said many times before, raylib is not an engine, and along that line, we should not entertain complex systems that are not easy for new users to pickup and user.
https://github.com/raysan5/raylib/discussions/4606


I guess if you wanted to "use an engine" you should really try out godot or unity - assume you will get a more "workflow" centered approach - setting up "entities" (spaceships with particle emission, animated weapon models, ..., ...) is surely easier ("visually") to do there ... but at the first glance they might lack something you consider as absolutely required. As they are used to actually create games I guess they should contain what you need - without you having to care much about the "how it is implemented".


Maybe your "dive into raylib" is also a chance to "dive into godot/unity" for a similar amount of time to check them out too - and kinda "compare" them afterwards. (of course for these tools you will have to invest a day into understanding their "visual" approach they will present you at first.

bye
Ron

Matty

Something I've had to learn with these smaller libraries (SDL2/ Raylib) is sometimes there are known bugs with features that should just work including:

SDL2 - supposedly it supports mp3 and other audio files but that's false -only wav files have ever worked with it properly.

Raylib - supposedly it supports jpg files for images, but that's also broken - it only supports tga/png and a few other formats..

So sometimes data file format support isn't what's listed on the tin.

Matty

Updated...corrected some bugs with the lighting (I was doing the falloff in reverse...forgot to do 1 - distance/light range and instead did simply distance/light range oops!


Matty

I've started working on a design for a game.....

The video below is full of placeholders and is in a very unfinished stage, but you should get the idea for what I'm planning on doing.....


Matty

There are animated ground units now.....



Oh...I had to cheat to get the units to animate. I don't have access to the formats or tools to convert the models I own into the only two formats that raylib supports for animation....so....I exported 100 frames of individual .obj files....and simply show them the way you'd show a sprite by picking the appropriate frame to display.....not a good solution if I had lots of little animated soldiers....but it works.