0
$\begingroup$

I am trying to generate a 2d image dataset form a 3d model rendered in Blender. I want to randomize the orientation of the object, the lightning and a background image.

My idea to randomize the lighting is to have a light aiming at the object at a fixed distance (radius) but otherwise positioned randomly around the object. By doing that I foresee a problem: there will be very strong shadows. The scene contains only the object, so there is nothing to reflect and spread the light.

How could I solve that? Would it work to have some "general" lighting and then have this other moving light in a way that all faces of the are never in absolute darkness? Is there a method (best practice) to lid and object quite evenly? Is there a certain type of light that spreads more than another?

Another important point is that the background of the rendered image should be either a solid color or transparent in order to replace it with a background image. Shadows on the background would be a problem.

And last thing to mention: I am just getting started with blender. So please tell me if you think I am trying to do something stupid or in a very wrong way. For example I am not sure if it makes to have a scene with only one object or it would be better to try to recreate a room scenario were the light is reflected in the walls more naturally.

My model

This is my model from 3DXtras and below is a render of it. This image shows pretty much the kind of lightning I want to achieve but with an solid colored background if possible.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Check this: blend-exchange.giantcowfilms.com/b/1970 and tell me what I should explain to you in answer. It's HDRI map as environment, plane with emission as light connected to circle above object and curved plane as background. $\endgroup$ – cgslav Sep 15 '16 at 11:04
  • $\begingroup$ So is the question about how to randomise lights or is it just how to get even lighting? $\endgroup$ – Ray Mairlot Sep 15 '16 at 11:30
  • $\begingroup$ How to get even lighting primarily. For the randomization I think I can manage but suggestions are welcome $\endgroup$ – nest Sep 15 '16 at 11:56
  • $\begingroup$ @LukeD Thanks for your link, I have a few questions. First I didn't understand the source of light, but I figured it's World => Surface. Does that lid everywhere evenly? Then didn't understand the reason for the BeizerCircle? Removing it doesn't seem to affect the render result. I also removed the Plane to obtain an even background. And finally I figured I can use Plane.001 to randomize the light, I am not sure how that is better than having a light object insted. Plus if that plain would be in the range of the camera it would be rendered as well, wouldn't it? $\endgroup$ – nest Sep 15 '16 at 12:09
  • $\begingroup$ Plane connected to circle behave like an area lamp, it allow you to change lightning as you describe you want to do it, yes it will be visible in render if positioned so. Secondly World > Surface is Environment map (HDRI) it is simulating photo studio ligthnig so it light evenly as much as what type of map do you use for this. $\endgroup$ – cgslav Sep 15 '16 at 12:16
2
$\begingroup$

In General

The ultimate purpose of every 3D render engine is to create 2D images of 3D objects in a way that they are recognizable as 3D objects. A main aspect of this is light - and therefore also shadows.

Depending on how realistic the source images are and how exact your image recognition software should work, keep that in mind.

Transparent Background

Guessing from your rendered image, I assume you are using cycles. To get a transparent background, just get rid of the object that generates the white plane(s), then go to "Properties Window - Render - Film" and mark the Checkbox for transparent background.

cycles transparent background

Light Setup

If you use Cycles instead of Blender internal you can avoid hard shadows to a point where there are nearly no shadows at all. Because it handles light "more naturally", it's really simple to recreate a diffuse light setup similar to what you would use in a photo studio setup.

Instead of a common light source, you can use planes, assign a light-emitting material to them and turn off their ray visibility. This method gives you more "visible" control over your light sources.

Depending on the plane's size and the strength of the light your shadows will get stronger. If you add more than one plane you can get to a point where there is nearly no shadowing at all.

Here's the result with one light-emiting plane:

one light-emiting plane

The same scene with six light-emiting planes, that are placed in even distances around the object:

six light-emiting planes

Remember to turn off the camera ray visibility for your light planes.

turn off camera ray visibility

Here's the .blend that contains the setup.

$\endgroup$
0
$\begingroup$

I have complemented the lighting setup from @metaphor_set's answer with a Blender script that randomizes the lighting intensity and position around the object. The purpose of the script is to generate an image dataset from a 3d model with N unique images. Feel free to use it to generate your own image datasets.

Download the project file:

Examples:

enter image description here enter image description here enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.