maybites / TextureSharing

Spout for Blender
118 stars 13 forks source link

Color management settings not respected #11

Closed MadlyFX closed 1 year ago

MadlyFX commented 3 years ago

This is likely a bug with Blender, but just in case it's not, I'm posting here as well.

https://developer.blender.org/T84227

Using Blender 2.93, the Spout output does not respect any of the color management settings associated with it. This includes the display device, exposure and gamma settings. This is problematic, as it defaults to Raw which produces an incorrect image.

Inkeddraw_view3d_LI

maybites commented 3 years ago

Looking at the bugreport it seems to be the issue: If the color corrections aren't applied, there is not much I can do here. This addon is based on the mentioned code example and just passes on the reference of the rendered texture to spout instead.

MadlyFX commented 3 years ago

Completely fair. Feel free to close this. And maybe we can post on the bug report to try and get it fixed :)

maybites commented 3 years ago

How do plan to use the spout addon? you mentioned you wanna use it for virtual production, but maybe you can elaborate on your setup?

MadlyFX commented 3 years ago

Sure! We provide in-camera set extension services (Mandalorian-style) for film and TV in Chicago, and are trying to get away from Unreal.

Right now the plan is to have Blender Spout the camera to Lightact. Both Lightact and Blender will receive camera tracking data, which Blender will use to render the correct perspective and Lightact will use to project that image onto a mesh representing an LED screen. That image then goes out to the LED screen and and appears correct to the physical camera.

The trick is the LED processors used can only output a 4K stream--but we deal with resolutions way beyond 4K, so we need a way to render parts of the same scene across multiple computers and have their outputs merged with Quadro sync. That's not something I expect from this plugin, but it's where I'm headed towards.

maybites commented 3 years ago

why do you wanna leave unreal?

MadlyFX commented 3 years ago

UE is great for quick prototypes, but Epic has an MO of adding an untested feature, abandoning it, and then leaving the community to pick up the slack. As a result, many of the systems they've implemented that are required for this are unstable or simply unusable.

Additionally, the deeper we get into this, the more it's "game engine-ness" is a restriction. We're not making a game, so there are a lot of things that are entirely unnecessary or get in the way--needless complexity and bloat. Blender has a number of features that would be extremely useful (simulation, modeling, etc.) that UE doesn't have.

If we need to put development work into an engine to make it usable, I'd much rather give back to the Blender community than to the Epic games monolith.

maybites commented 3 years ago

weirdly enough, I am unable to run the addon myself anymore... the script complains about a missing dll. But I have the SpoudSDK.pyd where its supposed to be. What did you do to make it work on your machine?

MadlyFX commented 3 years ago

weirdly enough, I am unable to run the addon myself anymore... the script complains about a missing dll. But I have the SpoudSDK.pyd where its supposed to be. What did you do to make it work on your machine?

Are you using Blender 3.0.0, or one of the newer beta branches? If so, they moved to Python 3.9 and won't see a library compiled with 3.7.

maybites commented 3 years ago

nope, its still 2.92..

MadlyFX commented 3 years ago

nope, its still 2.92..

Well that's odd, I just tried to reinstall it and it works for me. I'm on 2.92 as well. Maybe it's a DLL not related to the plugin?

maybites commented 3 years ago

this thread points to an answer: https://blender.stackexchange.com/a/210753

If someone can provide a code snipplet that converts the texture (aka the function transformRGBSpace())

def draw():
    ...
    offscreen.draw_view3d(
        scene,
        context.view_layer,
        context.space_data,
        context.region,
        view_matrix,
        projection_matrix)

>> additional conversion  offscreen.color_texture from linear-RGB-space to color-managment-RGB-space
    color-managed-texture = transformRGBSpace(offscreen.color_texture)
<<

    draw_texture_2d(color-managed-texture, (10, 10), WIDTH, HEIGHT)

I am willing to implement it to the addon.

cheers

martin

MadlyFX commented 3 years ago

It might be worth holding off until the Vulkan integration, since apparently the API is changing anyway.

MadlyFX commented 3 years ago

Looks like the fine Blender folks fixed this: https://developer.blender.org/D11645

maybites commented 3 years ago

cool. I will make a new branch for 3.0.0 then and implement it there..

coffeebreak42 commented 2 years ago

Pinging this @maybites I'm trying to use this plugin, but the colors are off... right now the image I'm getting from spout is much darker and different than what is in my blender viewport. See attached spout vs blender viewport. test1 test2

coffeebreak42 commented 2 years ago

Okay I solved the problem. Please push these changes, I do not know how to recommend the changes, I'm new to GitHub. Basically the blender ppl set do_color_management to FALSE by default for some reason. You have to manually set it to TRUE for color_management to be applied correctly. SOLUTION IN BOLD, within the init.py.

offscreen.draw_view3d(
    scene,
    context.view_layer,
    context.space_data,
    context.region,
    view_matrix,
    projection_matrix,
**do_color_management=True)**
maybites commented 2 years ago

there is already a branch with this fix.