Open beltegeuse opened 4 years ago
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.
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).
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.
Hi Stigatle,
Do you have any idea of how to handle the area light source in Blender?
For example, these light sources are pretty common on Blendswap's model (for example, https://www.blendswap.com/blend/17404 with the screenshot below)
For now, I have a working prototype that converts this type of light source into rectangular area lights. But the problem is that the light source will be visible (even if I use "none" BSDF!).
Do you think that the blender needs to export such type of light? Because I think these type of light that are invisible inside the scene is not compatible with PBRT.