Coder Social home page Coder Social logo

Comments (8)

NthTensor avatar NthTensor commented on September 25, 2024 1

The issue is that, as I understand it, the default exposure is tuned to match blender. So one would expect a gltf exported from blender to have visually similar emission. That's not the case.

from bevy.

IDEDARY avatar IDEDARY commented on September 25, 2024

I encountered this issue too while exporting a GLTF from Blender.
What might be happening is that during the conversion process the value is somehow super scaled down.

  • Blender: 5.0 Emission strength - Should be quite emissive, it shines brightly in Blender and other GLTF viewers, in Bevy you cannot see any glow.

  • Blender: 200_000.0 Emission strength - The emission radius is several times the size of the object in Blender and other GLTF viewers are broken, in Bevy you can finally see a bit of glow.

from bevy.

NthTensor avatar NthTensor commented on September 25, 2024

No exact causes, but here's some info: Gltf emission map is in candela per square meter. Emission strength is a unit-less quantity which scales the emission map (so that the final output also has units of candela per square meter). This issue means we probably are messing up the units somewhere.

from bevy.

Overblob avatar Overblob commented on September 25, 2024

I just bisected between v0.12 and v0.13 to find the responsible commit: fcd7c0f and associated PR: #11347

(Despite what I said, it finally may be related to exposure...)

from bevy.

Overblob avatar Overblob commented on September 25, 2024

// Total light
output_color = vec4<f32>(
view_bindings::view.exposure * (transmitted_light + direct_light + indirect_light + emissive_light),
output_color.a
);

Here we can see that the emissive_light gets multiplied by the exposure.

I tested after having moved out this variable from the parenthesis and boom, bloom worked again!

Still I'm not sure about this solution, as I don't master the exposure semantics.

As a side note, I 'd like to mention that as of #11347 examples for 2d and 3d bloom are not homogeneous when defining color values: not the same function, nor the same value ranges at all:

// Sprite
commands.spawn(SpriteBundle {
texture: asset_server.load("branding/bevy_bird_dark.png"),
sprite: Sprite {
color: Color::srgb(5.0, 5.0, 5.0), // 4. Put something bright in a dark environment to see the effect
custom_size: Some(Vec2::splat(160.0)),
..default()
},
..default()
});

let material_emissive1 = materials.add(StandardMaterial {
emissive: Color::linear_rgb(23000.0, 9000.0, 3000.0), // 4. Put something bright in a dark environment to see the effect
..default()
});

from bevy.

fintelia avatar fintelia commented on September 25, 2024

No exact causes, but here's some info: Gltf emission map is in candela per square meter. Emission strength is a unit-less quantity which scales the emission map (so that the final output also has units of candela per square meter). This issue means we probably are messing up the units somewhere.

Does that mean the tested value corresponds to 5 cd/m^2? Since that's is pretty low considering an LCD computer monitor is 200-300 cd/m^2 and Bevy's default exposure corresponds to a very bright indoor space / a heavily overcast outdoor scene. In those conditions, there's no way something 40x dimmer is going look like it is glowing...

from bevy.

fintelia avatar fintelia commented on September 25, 2024

The default exposure is tuned so that point lights and directional lights match Blender. Everyone assumes that Blender got the math right, but I'm personally not very convinced.

One possible explanation is that blender is multiplying the values of lights by 683 before exporting, but is leaving the emissive materials with their original scale. Thus when imported into Bevy emissives are 683x dimmer than they appear in Blender.

from bevy.

IDEDARY avatar IDEDARY commented on September 25, 2024

The default exposure is tuned so that point lights and directional lights match Blender. Everyone assumes that Blender got the math right, but I'm personally not very convinced.

One possible explanation is that blender is multiplying the values of lights by 683 before exporting, but is leaving the emissive materials with their original scale. Thus when imported into Bevy emissives are 683x dimmer than they appear in Blender.

This simple multiplication doesn't really match my observed values, either the problem is more complex, or a different number is used :P

Blender: 5.0 Emission strength - Should be quite emissive, it shines brightly in Blender and other GLTF viewers, in Bevy you cannot see any glow.
Blender: 200_000.0 Emission strength - The emission radius is several times the size of the object in Blender and other GLTF viewers are broken, in Bevy you can finally see a bit of glow.

from bevy.

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.