POV-Ray : Newsgroups : povray.general : a little ray tracer Server Time
6 May 2026 11:08:51 EDT (-0400)
  a little ray tracer (Message 11 to 15 of 15)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mr
Subject: Re: a little ray tracer
Date: 5 May 2026 20:50:00
Message: <web.69fa8f351235ce78fe29df036830a892@news.povray.org>
I suddenly feel like I was off topic as, seeing no attachment and reading too
fast missed the line with repo link so I did not realize there was something to
try out already sorry! but is it actually POV-Ray

or else, might the discussion have been posted into a more explicit category
such as pov4.discussion.general?

The concept of nim sounds good to me, but seeing your repo reads more obscure to
me than some pov code... Sorry to be thick at this late hour, so is it elements
of a new renderer itself? if so, what would the syntax invoking them look like?


Post a reply to this message

From: ingo
Subject: Re: a little ray tracer
Date: 6 May 2026 04:59:40
Message: <69fb02fc$1@news.povray.org>
On 2026-05-06 02:45, Mr wrote:
> I suddenly feel like I was off topic as, [...]

No problem.

> [...] what would the syntax invoking them look like?
> 

Currently it's not all very well organized. For example in scene.nim 
there are mixed reposibilities. The whole intersection / traversal logic 
there should go to the raytracer file. Also the loop in main should go 
there.

The ppm generation is only "instant gratification" the database will be 
the result and it will contain HDR data. An image could be extracted 
with something that does:

proc exportPPM*(db: DbConn, frame: int, filename: string) =
   let rows = db.allRows(sql"""
     SELECT pixel_x, pixel_y,
            tonemap_reinhard(sum(rgb_r)) AS r,
            tonemap_reinhard(sum(rgb_g)) AS g,
            tonemap_reinhard(sum(rgb_b)) AS b
     FROM (
       SELECT pixel_x, pixel_y,
              spectral_to_rgb(contribution, wavelength) AS (r,g,b)
       FROM final_pixel_values
       WHERE frame = ?
     ) GROUP BY pixel_x, pixel_y
   """, frame)

   writePPM(filename, rows, width, height)


this is currently the whole scene description:

----
var sc = initScene()

# Materials
let matFloor = sc.addMaterial(Material(colour: vec3(0.8f, 0.8f, 0.8f)))
let matSphere = sc.addMaterial(Material(colour: vec3(0.8f, 0.2f, 0.2f)))
let matBox = sc.addMaterial(Material(colour: vec3(0.2f, 0.6f, 0.2f)))

# Shapes
discard sc.addShape(plane(vec3(0f, 1f, 0f), -1f, matFloor))
discard sc.addShape(sphere(vec3(0f, 0f, -3f), 1f, matSphere))
discard sc.addShape(box(vec3(-2f, -1f, -4f), vec3(-0.5f, 0.5f, -2f), 
matBox))

initPerspectiveCamera(
   relays = relays,
   pos = vec3(0f, 1f, 2f),
   lookAt = vec3(0f, 0f, -3f),
   up = vec3(0f, 1f, 0f),
   fovDeg = 60f,
   width = Width,
   height = Height
)

initRaytracerRenderer(relays, sc)

addPointLight(relays, vec3(5f, 8f, 2f),  vec3(1f, 1f, 1f),       100f)
addPointLight(relays, vec3(-3f, 4f, 0f), vec3(0.4f, 0.6f, 1f),    40f)

initColourMaterial(relays, sc)
initBlueBackground(relays)

----

I do not like that!

initScene() annoyed me. But then, one can put multiple scene in one file 
and render them in orther. Scene2 can the re-use, abuse, data from 
scene1. (Contrived crazy example, Scene One can be an animation of a 
ball bouncing against a wall many times, denting it a bit and leaving 
some colour. Train a little neural net with it. Scene Two uses the net 
for texture and displacement mapping generation.)

Currently an order in the scene is required. Not nice, maybe things can 
be ordered after a "parsing" step.

Initializing the relays can be "hidden", be done lazy. When adding a 
light source check whether a render relay is initialized if not do it.

Also shapes and materials do not look nice, I just chose the easy way to 
get the whole ting going. And, certainly there is a lot I've not thought 
about yet.

ingo


Post a reply to this message

From: ingo
Subject: Re: a little ray tracer
Date: 6 May 2026 05:05:57
Message: <69fb0475$1@news.povray.org>
On 2026-05-05 23:18, jr wrote:
> "nagging feeling"

Hah, I have a 2000 lines "design" document, there's quite a few lines in 
it that evoke that feeling, so it's in constant flux. Might be an awful 
lot of work to find yet another dead end street, but we can hope that 
there is a good pub at the end of it then.

ingo


Post a reply to this message

From: Bald Eagle
Subject: Re: a little ray tracer
Date: 6 May 2026 08:10:00
Message: <web.69fb2f161235ce789839f6ab25979125@news.povray.org>
ingo <ing### [at] nomailcom> wrote:
> Might be an awful
> lot of work to find yet another dead end street, but we can hope that
> there is a good pub at the end of it then.

Having worked on many projects at many different levels, it is just as important
to know and document what DID NOT work.  (And what was learned along the way)

So much so, that governments here even steal our wages to manufacture and
install metal signs that read "DEAD END". ;)

- BW


Post a reply to this message

From: ingo
Subject: Re: a little ray tracer
Date: 6 May 2026 08:55:02
Message: <69fb3a26$1@news.povray.org>
On 2026-05-06 14:07, Bald Eagle wrote:
> So much so, that governments here even steal our wages to manufacture and
> install metal signs that read "DEAD END". ;)

Is the situation that dire out there at the moment? :(

I used to do product development in the past. Keeping an "engineers 
diary" was extremely valuable.

ingo


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.