9

[parse_blend_file] Attic Close-up · Issue #136 · wahn/rs_pbrt · GitHub

 2 years ago
source link: https://github.com/wahn/rs_pbrt/issues/136
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Owner

Author

wahn commented 6 days ago

The current Blender scene (using Cycles), which I downloaded from the Blender Cloud, renders like this:

Copy link

Owner

Author

wahn commented 6 days ago

The current version of the Blender (2.79) scene does render already via parse_blend_file, but the light blocking geometry is not visible yet, because another light blocker (which uses a transparency texture) is currently blocking all light from the sun (directional light source):

The lighting actually comes from two point lights, which are just fill lights and are in the original scene as well. The main lighting is supposed to come from the sun. So one task for this issue is to make parse_blend_file being aware of transparency textures and to adjust the scene for Blender 2.79 to be usable directly as input.

Copy link

Owner

Author

wahn commented 6 days ago

You can see that both kind of light blockers (geometry vs. texture) are already in the scene if you render via Cycles:

Copy link

Owner

Author

wahn commented 5 days ago

Before we can investigate how to store the transparency texture in a Blender (2.79) file (in a way that we can pick it up using the Blender DNA), we should look at another scene to see how this is done for Cycles. This scene can be exported via the multi exporter, a former Python add-on I used to export from Blender to many other renderers, including Luxrender and PBRT (v3):

Let's look into how this would be translated to a .pbrt (v3) file to understand how the add-on should translate this ... and later how this can be stored in the DNA to be picked up by parse_blend_file ...

Copy link

Owner

Author

wahn commented 4 days ago

I had to change the code for triangle meshes (see commit bbadb88) to allow the usage of an alpha texture (RGB for now) to hide geometry:

In a .pbrt file that would look like this:

...
  # Plane                                                                                               
  Texture "Plane::Kd" "color" "imagemap"
    "string filename" ["textures/leaf.png"]
    "bool gamma" ["false"]
  Texture "Plane::alpha" "float" "imagemap"
    "string filename" ["textures/leaf_alpha.png"]
    "bool gamma" ["false"]
  MakeNamedMaterial "Plane"
    "string type" [ "matte" ]
    "texture Kd" [ "Plane::Kd" ]
...
  # Plane                                                                                               
  AttributeBegin
    Transform [
...
    ]
    NamedMaterial "Plane"
    Shape "trianglemesh"
      "point P" [
        -1.0 -1.0 0.0
        1.0 -1.0 0.0
        1.0 1.0 0.0
        -1.0 1.0 0.0
      ]
      "integer indices" [
        0 1 2
        0 2 3
      ]
      "float uv" [
        0.0 0.0
        1.0 0.0
        1.0 1.0
        0.0 1.0
      ]
      "texture alpha" [ "Plane::alpha" ]
      "texture shadowalpha" [ "Plane::alpha" ]
  AttributeEnd
...

Currently I can't use the alpha channel directly (needs to be improved at some point), instead I load two textures, one for the color (RGB), the other for alpha (still stored in an RGB image). The color texture is used in the material (for the diffuse color), and the alpha texture is used to hide geometry (from two triangles with texture coordinates). Be aware that alpha and shadowalpha are parameters of the Shape and are used in the ray intersection function.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK