POV-Ray : Newsgroups : povray.binaries.images : Text Isosurfaces Server Time
14 Mar 2025 09:34:57 EDT (-0400)
  Text Isosurfaces (Message 1 to 3 of 3)  
From: Chris R
Subject: Text Isosurfaces
Date: 12 Mar 2025 14:35:00
Message: <web.67d1d3b0dd1b1e6044dc80f55cc1b6e@news.povray.org>
If you have seen any of my posted renderings and read my comments, you will know
that I am a big fan of using isosurfaces.  Most of the objects in any scene I
create are isosurfaces, unless I am absolutely sure I will not need to apply any
sort of irregular, visible, surface texture to them.

With my latest exploration of SDFs, and how to use them with isosurfaces, I have
a library that covers pretty much all of the POV-RAY SDL primitive objects as
isosurface SDF functions, so I can create just about anything... except text.

There are a number of articles about how to create SDFs for text objects,
including GPU-based game platforms that do this automatically, but I haven't
found anything that would work well with POV-Ray, other than something that
generates meshes.  Even then, applying a bumpy surface to a pre-defined mesh
isn't easy.

So, I have resorted to the following:
1. Create a text{} object representing the text I want to render.
2. Create a pigment using the object pattern from that text:
   pigment {
      object {
         _text_object
         rgb 1
         rgb -1
      }
   }
3. Create a pigment function from the pigment
4. Create an isosurface using the pigment function as the function and
add/subtract my surface texture function to it.

The difficulty I have had with this is that the pigment function isn't
continuous, so it doesn't really function as an SDF.  This can make it difficult
to get the surface texture to "stick" correctly.  Plus, the wider the difference
between the "in" and "out" values, the higher the max_gradient I need to get rid
of artifacts.

It does help to use smaller, more appropriate values for the in/out, generally
something just large enough to reflect the maximum extent of the surface texture
being applied, but the discontinuity can still be an issue.

So, I have taken a new approach to create a pseudo SDF by creating N instances
of the pigment function with the object scaled smaller than 1, (representing the
interior), and M instances scaled at greater than 1, (representing the
exterior), and assigning a distance from the surface of the original object that
those scales represent.  The isosurface shape function then finds the smallest
scaled instance of the object that the point lies within and assigns the
distance associated with that scale as the distance from the surface.

Depending on how accurate, (and slow), I want the image to be, I can make the
new step-distance-function as close to continuous as I need to get a good
result, while keeping the max_gradient reasonable.

Here is an example.  The top, white object is just text {... "What" }.  The
bottom, textured one is an isosurface using this pseudo-SDF function with 3
interior and 3 exterior scale values that cover the range where the bumpy
surface texture would apply.  (The surface texture is a warped crackle pattern).
 Accuracy was 0.005, and max_gradient was 10.

I added some code for creating the pseudo-SDF to libisoshapes.inc:
Iso_object(Object,Gradient) and some functions for creating the gradients that
define the values and scales Iso_object_scale_gradient_create_size().

One important note using this method; the object to be converted should be
centered at the origin.  I used the previously defined Text_metrics macros from
libtext.inc to help with this.


-- Chris R.


Post a reply to this message


Attachments:
Download 'text_test.png' (230 KB)

Preview of image 'text_test.png'
text_test.png


 

From: William F Pokorny
Subject: Re: Text Isosurfaces
Date: 13 Mar 2025 14:10:56
Message: <67d31fb0$1@news.povray.org>
On 3/12/25 14:34, Chris R wrote:
> So, I have taken a new approach to create a pseudo SDF by creating N instances
> of the pigment function with the object scaled smaller than 1, (representing the
> interior), and M instances scaled at greater than 1, (representing the
> exterior), and assigning a distance from the surface of the original object that
> those scales represent.  The isosurface shape function then finds the smallest
> scaled instance of the object that the point lies within and assigns the
> distance associated with that scale as the distance from the surface.

Interesting. This is an approach different than I've seen for 
establishing a gradient about the surface of an object. Wondering some 
about how the scaling is handled in detail. I've put it on my list to 
review your code. Thank for making it available!

Bill P.


Post a reply to this message

From: Bald Eagle
Subject: Re: Text Isosurfaces
Date: 13 Mar 2025 15:50:00
Message: <web.67d3364b3b40b7dcd2a18eff25979125@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:


> Interesting. This is an approach different than I've seen for
> establishing a gradient about the surface of an object. Wondering some
> about how the scaling is handled in detail. I've put it on my list to
> review your code. Thank for making it available!
>
> Bill P.

Yes, I thought so too.
I remember doing something with f_r (), and creating an artificial gradient
across the hard boundary of the object pattern - but I've looked for the past 2
days and haven't found the file or render where I did those experiments.

I'm pretty dure that I discussed the details with you though - in reference to
your object-as-isosurface project.

- BW


Post a reply to this message

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