Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[parse_blend_file] Attic Close-up #136

Open
wahn opened this issue Oct 23, 2021 · 5 comments
Open

[parse_blend_file] Attic Close-up #136

wahn opened this issue Oct 23, 2021 · 5 comments
Assignees

Comments

@wahn
Copy link
Owner

wahn commented Oct 23, 2021

On the Blender Cloud there is a project called Attic Close-up (by Gleb Alexandrov). You can download a Blender scene from there. The goal of this issue is to create a similar Blender (version 2.79) scene, which can be used to render directly with parse_blend_file (see examples folder).

@wahn wahn self-assigned this Oct 23, 2021
@wahn
Copy link
Owner Author

wahn commented Oct 23, 2021

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

attic_close_up_cloud

@wahn
Copy link
Owner Author

wahn commented Oct 23, 2021

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):

pbrt

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.

@wahn
Copy link
Owner Author

wahn commented Oct 23, 2021

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

attic_close_up_v279_cycles_01

@wahn
Copy link
Owner Author

wahn commented Oct 25, 2021

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):

attic_cycles_transparent_texture

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 ...

@wahn
Copy link
Owner Author

wahn commented Oct 25, 2021

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:

pbrt

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant