Giter VIP home page Giter VIP logo

Comments (3)

stig-atle avatar stig-atle commented on May 28, 2024

Yeah, that would be great to have support for.
Do you have a example of what you write them out as now?
Pbrt has the DiffuseAreaLight, is it that you are writing it as?
Or are you creating a mesh plane and then applying a blackbody material to it?

DiffuseAreaLight::DiffuseAreaLight(const Transform &LightToWorld,
                                   const MediumInterface &mediumInterface,
                                   const Spectrum &Lemit, int nSamples,
                                   const std::shared_ptr<Shape> &shape,
                                   bool twoSided)

I do not think we can 'hide' the light source, but there is a bool for twosided, which means we can look 'through' the light source from behind (and it will only cast light 'forwards').

We also need to get all those custom parameters for PBRT in there, same with point\spot and so on, but that's another task on the todo list.

from io_scene_pbrt.

beltegeuse avatar beltegeuse commented on May 28, 2024

Currently, I create a mesh an attach it with a "diffuse" light source.

One example of output (inside PBRT file):

    AttributeBegin
		Transform [-0.142275 -0.567970 0.810659 0.000000 -0.275366 0.809372 0.518740 0.000000 -0.950753 -0.149424 -0.271553 0.000000 -3.382452 -0.479583 0.946010 1.000000 ]
		Scale 7.0 1.0 1.0 
		Scale 0.5 0.5 -1.0 
		
		AreaLightSource "diffuse" "rgb L" [ 4.784638285636902 10.0 0.14450596645474434 ]
		
		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 ]		
		"normal N" [ 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 ]		
		"float UV" [ 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 ]		
		"integer indices" [ 0 1 2 2 3 0]		
	AttributeEnd

The python code responsible to generate this output:

        if la.type == "AREA" :
                pbrt_file.attr_begin()
                # Transform
                pbrt_file.write( "Transform [" + matrixtostr( ob.matrix_world.transposed() ) + "]\n" )
                pbrt_file.write( f"Scale {la.size} {la.size_y} 1.0 \n" )
                pbrt_file.write( f"Scale 0.5 0.5 -1.0 \n" )
                pbrt_file.write("\n")
                pbrt_file.write( f'Material "none"\n' )
                # Radiance
                pbrt_file.write(f'AreaLightSource "diffuse" "rgb L" [ {light_color[0]} {light_color[1]} {light_color[2]} ]\n')
                pbrt_file.write("\n")
                # Shape
                pbrt_file.write(r'Shape "trianglemesh"')
                pbrt_file.write("\n")
                pbrt_file.write(r'"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 ]')
                pbrt_file.write("\n")
                pbrt_file.write(r'"normal N" [ 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 ]')
                pbrt_file.write("\n")
                pbrt_file.write(r'"float uv" [ 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 ]')
                pbrt_file.write("\n")
                pbrt_file.write(r'"integer indices" [ 0 1 2 2 3 0]')
                pbrt_file.write("\n")
                pbrt_file.attr_end()

I do not think we can 'hide' the light source

Well, I am not sure. The only idea I can think of is using the "none" material. This material act as a passthrough for the volumetric path tracer (as mesh are used to define participating media boundaries). However, this material might only be compatible with this specific integrator (I am not super familiar with PBRT-v3; I have to check this later).

from io_scene_pbrt.

stig-atle avatar stig-atle commented on May 28, 2024

I have not tried the 'none' material, so I do not know if it's only supported by specific integrators.

If the 'none' material is not supported well - then it would be nice to use the 'area light' directly - if the 'none' material is not supported by other integrators, that way area lights will be supported the same way as in pbrt.

from io_scene_pbrt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.