owl-project / NVISII

Apache License 2.0
330 stars 28 forks source link

Disable shading for an entity's texture #123

Closed liswp closed 3 years ago

liswp commented 3 years ago

Is there a way to disable shading for an entity's texture such that the brightness of an entity becomes much brighter? Thank you.

natevm commented 3 years ago

One option could be to add a light component to your entity instead of the material component, then on the light component. If the entity is textured, you could use the set_color_texture function.

Alternatively, you could add some light sources around your object to make it brighter.

In general, we try to make the light simulation energy conserving, such that the outgoing light intensity is never more than the incoming light intensity. Otherwise, the image will stop looking physically correct. If you want to make an object brighter than the incoming light that's illuminating that object, then that object needs to add energy to the system by using a light component.

liswp commented 3 years ago

@natevm One option could be to add a light component to your entity instead of the material component, then on the light component. If the entity is textured, you could use the set_color_texture function.

Thank you very much, and may I confirm that this is what you are referring to?

obj_entity = nvisii.entity.create(name="light_2", mesh=nvisii.mesh.create_teapotahedron('light_2'), transform=nvisii.transform.create("light_2"), ) obj_entity.set_light(nvisii.light.create('light_2')) obj_entity.get_light().set_intensity(2) obj_entity.get_light().set_color_texture(tex)

natevm commented 3 years ago

Yeah, that works. Here’s another slightly cleaner way:

obj_entity = nvisii.entity.create(name="light_2", mesh=nvisii.mesh.create_teapotahedron('light_2'), transform=nvisii.transform.create("light_2"), 
light=nvisii.light.create('light_2'))
obj_entity.get_light().set_intensity(2)
obj_entity.get_light().set_color_texture(tex)

Note though that you might find your image becomes a bit more noisy.

natevm commented 3 years ago

Ah, I should also mention, the light component allows you to control both intensity as well as exposure. The “intensity” of the light effects the direct appearance of the light, so eg an intensity of 2 will make the light texture color look twice as bright. The light “exposure” on the other hand only effects how much light is cast from the original light source, and does not effect the direct appearance of the light. So if you want an object to stand out as if it were a light source, but then you don’t want the object to actually emit light into the scene, you could set intensity to 1 and then exposure to something like -100

natevm commented 3 years ago

Closing this issue for now. If you run into issues, please let me know!