POV-Ray : Newsgroups : povray.general : Scanline rendering in POV-Ray : Scanline rendering in POV-Ray Server Time
4 Aug 2024 10:21:15 EDT (-0400)
  Scanline rendering in POV-Ray  
From: Ray Gardener
Date: 1 Jun 2003 16:06:48
Message: <3eda5cd8$1@news.povray.org>
I don't know if this has been done before,
but I couldn't find any material on the topic, so...

(I think someone had made an OpenGL renderer
based on POV-Ray, but I'm not sure).

I'm currently investigating development of a
scanline renderer, because the scenes I need
to support (landscape scenes) typically contain
too many objects for efficient raytracing.

To save development time and effort, I've
looked at various existing programs. One of
these programs, of course, is POV-Ray, although
at first glance I didn't consider it because
POV is a raytracer.

However...

POV-Ray is also more. Unlike RIB, it implements
a scripting language, which is ideally suited
to the creation of large numbers of objects
without having to link in external code.
It supports a good set of primitives, and
handles animation. It does CSG. It has a large
texture library. Lots of people know, use,
and support POV-Ray. From the perspective
of specifying scenes, POV-Ray is robust.
For any renderer (regardless of how they render),
these "front-end" attributes are desirable.

I realize, of course, that certain effects
will not be directly supportable (e.g., true reflections,
refractions, shadows, etc.). However, that still
leaves a lot of cases where the objects I need
to draw look alright. There is also the possibility
of combining scanline and raytracing (more on that below).
The idea may even have merit purely on utility
grounds: previewing a scene could be done both
fairly well, with great speed, and conveniently
within the same program.

My next step is a test case whereby POV-Ray
is modified to support scanline rendering.
The approach is basically:

  - Initialize a z-buffer (POV's existing
    'hf_gray_16' keyword may already do this).

  - Skip the building of the bounding slabs
    hierarchy and any other data structures
    relating to the scene geometry database.

  - Route all primitive creation to the
    scanline renderer for immediate rasterization
    and z-buffer updating (some of the more
    exotic primitives may not be supportable).

  - Invoke the texturing code from the scanline's
    polygon rasterizer, providing it with
    whatever coordinates are necessary to
    handle texel lookup and perspective correction.

  - (In the future) Add other keywords to
    simplify the creation and use of shadowmaps and
    other entities required to support global
    effects in scanline systems.


Instead of forking POV-Ray, however, it shouldn't
be hard to add a mode keyword to the script language
so that rendering could be switched dynamically
between raytracing and scanlining. The raytracer,
however, would need to update the z-buffer so
that scanlined objects would be composited
properly into the output image.

I'm interested in knowing if anyone has already
tried this, what the challenges were, etc.


Ray Gardener
Daylon Graphics Ltd.
"Heightfield modeling perfected"
http://www.daylongraphics.com


Post a reply to this message

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