LDraw.org Discussion Forums

Full Version: Camera, lights
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
What is the official method of adding cameras and light sources to models?

I was thinking it would be nice to add camera/lookat and lightsource/pointat pairs in a single line in a model. This would require some sort of extension. Has someone done this before?
(2016-08-21, 13:05)Michael Horvath Wrote: [ -> ]What is the official method of adding cameras and light sources to models?

I was thinking it would be nice to add camera/lookat and lightsource/pointat pairs in a single line in a model. This would require some sort of extension. Has someone done this before?

I've been working on animation POV-Ray export for LDCad 1.6 and was wondering about this a while back. In the end I choose to have camera's (and lights) only exist during playback so no meta storage.

Also light and camera have many options which will differ between renderers so if a official meta is considered I think it should be user extendable.
(2016-08-21, 13:05)Michael Horvath Wrote: [ -> ]What is the official method of adding cameras and light sources to models?

I was thinking it would be nice to add camera/lookat and lightsource/pointat pairs in a single line in a model. This would require some sort of extension. Has someone done this before?

The official file light.dat was designed to be used for this. That file was created by James Jessiman, so it's been around for a long time. The color you use to specify this file is the color of the light source. (Same with the brightness.) Unfortunately, there's no real standard on how this should be used for a light source. LDView supports light.dat for its real-time 3D rendering, converting it into an OpenGL point light source (paying attention to the RGB value of the model reference to determine color and brightness). But I never got around to supporting it during POV export (although I'm pretty sure it would be possible to hack in support after-the-fact using a top include).
Just want to add that light.dat by itself is not enough for spotlights. Which is why it would be nice to specify them as a pair.
(2016-08-22, 14:00)Michael Horvath Wrote: [ -> ]Just want to add that light.dat by itself is not enough for spotlights. Which is why it would be nice to specify them as a pair.

This could be done with my Datshine program, but it takes knowledge in POV-Ray coding and inlining POV code into LDraw files.
(2016-11-06, 12:34)Tore Eriksson Wrote: [ -> ]
(2016-08-22, 14:00)Michael Horvath Wrote: [ -> ]Just want to add that light.dat by itself is not enough for spotlights. Which is why it would be nice to specify them as a pair.

This could be done with my Datshine program, but it takes knowledge in POV-Ray coding and inlining POV code into LDraw files.

This is not a spotlight, but a general illumntion "Light Brick" I made with DatShine of a 1x4 plate. In ML-Cad and LDView, it looks like a normal clear 1x4 plate. but in POV-ray, it emitts light. I know there is POV code for spotlights, too, but I never experimented with it.

Code:
0 Plate  1 x  4 Clear with POV Light
0 Name: 3710L47.dat
0 // Generated by DatShine v2.01
0 Author: Tore Eriksson
0 Unofficial LDraw Part
0 // based on work by James Jessiman
0 // Credits to Anders Isaksson and Tim Gould
0 // http://news.lugnet.com/cad/ray/?n=2764

0 L3P IFPOV
0 light_source {
0     <0, 0, 0>
0     color rgb 0.4*<0.9,0.9,0.9>
0     // fade_distance 60.0
0     // fade_power 1.6
0     looks_like {_3710_dot_dat texture {
0         pigment { rgbf <0.9,0.9,0.9,0.90> }
0         finish { ambient 0.6 diffuse 0 phong 0.5 phong_size 40
0             reflection 0.9
0             refraction 1 ior 1.25
0             }
0         }
0 }    }
0 L3P ELSEPOV
1 47  0 0 0  1 0 0  0 1 0  0 0 1  3710.dat
0 L3P ENDPOV

0

It works with L3P, with or without L3PAO, but I'm not sure if it works with LDView. Here's the result:

[Image: moonbaselarger_Q2.png]
(2016-11-06, 12:34)Tore Eriksson Wrote: [ -> ]
(2016-08-22, 14:00)Michael Horvath Wrote: [ -> ]Just want to add that light.dat by itself is not enough for spotlights. Which is why it would be nice to specify them as a pair.

This could be done with my Datshine program, but it takes knowledge in POV-Ray coding and inlining POV code into LDraw files.

Do you have a link to DatShine?
(2016-11-07, 15:41)Michael Horvath Wrote: [ -> ]
(2016-11-06, 12:34)Tore Eriksson Wrote: [ -> ]This could be done with my Datshine program, but it takes knowledge in POV-Ray coding and inlining POV code into LDraw files.

Do you have a link to DatShine?

I didn't, but now I have. Smile
DatShine for Windows

There's a minor bug in it. You'll have to insert "0 " at the beginning of each created part's first line. I would correct it, but I don't think I have the source code left. Sorry, no instructions. If you get stuck, I can guide you through.
(2016-11-07, 16:14)Tore Eriksson Wrote: [ -> ]
(2016-11-07, 15:41)Michael Horvath Wrote: [ -> ]Do you have a link to DatShine?

I didn't, but now I have. Smile
DatShine for Windows

There's a minor bug in it. You'll have to insert "0 " at the beginning of each created part's first line. I would correct it, but I don't think I have the source code left. Sorry, no instructions. If you get stuck, I can guide you through.

What does this program even do?
(2016-11-07, 17:18)Michael Horvath Wrote: [ -> ]
(2016-11-07, 16:14)Tore Eriksson Wrote: [ -> ]I didn't, but now I have. Smile
DatShine for Windows

There's a minor bug in it. You'll have to insert "0 " at the beginning of each created part's first line. I would correct it, but I don't think I have the source code left. Sorry, no instructions. If you get stuck, I can guide you through.

What does this program even do?
I posted a reply here, but it looks like it never made it(?)

It changes the property of the parts into shining objects. See the lights in the ceiling of the Moonbase above, and the headlights of the car in this post. They still look normal in any LDraw editor or viewer, and once vreated by DatShine, you treat them as any other LDraw part. But after being processed by L3P, those parts emit light in POV-Ray. I'm sure you can make a spotlight object in Datshine if you know the POV syntax for spotlights.
[Image: demo2.jpg]
Pages: 1 2