bge.texture.ImageRender alpha channel returns 255 for every pixel #32175

Closed
opened 2012-07-24 20:43:12 +02:00 by Kevin Smith · 25 comments

Category: Rendering

%%%When using image = bge.texture.ImageRender() the alpha channel always returns 255 for every pixel. The red green and blue channels all work.

image = bge.texture.ImageRender(scene, cam)
image.alpha = True
image.background = (0, 0, 0, 0)
buffer = bge.texture.imageToArray(image, "AAA1")%%%

**Category**: Rendering %%%When using image = bge.texture.ImageRender() the alpha channel always returns 255 for every pixel. The red green and blue channels all work. image = bge.texture.ImageRender(scene, cam) image.alpha = True image.background = (0, 0, 0, 0) buffer = bge.texture.imageToArray(image, "AAA1")%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

#37396 was marked as duplicate of this issue

#37396 was marked as duplicate of this issue

%%%Blender (and more specifically ghost) does not request and alpha channel for it's render context. On Nvidia cards, you only get a GL_RGB context, but on ATI/AMD, you get GL_RGBA. Since ImageRender is making use of the back buffer (as opposed to an FBO, which it should be using instead), you are stuck with whatever Ghost managed to get. I'm guessing you're using an Nvidia card which is why you always get 255 for the alpha value. Could someone test this on an ATI/AMD card to confirm?%%%

%%%Blender (and more specifically ghost) does not request and alpha channel for it's render context. On Nvidia cards, you only get a GL_RGB context, but on ATI/AMD, you get GL_RGBA. Since ImageRender is making use of the back buffer (as opposed to an FBO, which it should be using instead), you are stuck with whatever Ghost managed to get. I'm guessing you're using an Nvidia card which is why you always get 255 for the alpha value. Could someone test this on an ATI/AMD card to confirm?%%%

%%%ghost right now is not trying to get RGBA at all.
There is a patch for that (though I didn't test it with video texture) that may be worth committing.

It's old, but if you want to try, it would be nice to see if it fixes this bug:
http://projects.blender.org/tracker/?func=detail&aid=18967&group_id=9&atid=306%%%

%%%ghost right now is not trying to get RGBA at all. There is a patch for that (though I didn't test it with video texture) that may be worth committing. It's old, but if you want to try, it would be nice to see if it fixes this bug: http://projects.blender.org/tracker/?func=detail&aid=18967&group_id=9&atid=306%%%
Author

%%%I'm not much of a Windows programmer and haven't been able to get Blender to compiler on Windows. My only Windows box is running Windows 8 so that might be the problem. Does the patch work on OS X? If not, any chance I could get a binary with the patch?%%%

%%%I'm not much of a Windows programmer and haven't been able to get Blender to compiler on Windows. My only Windows box is running Windows 8 so that might be the problem. Does the patch work on OS X? If not, any chance I could get a binary with the patch?%%%

%%%Hi Kevin. The patch I mention was finally commitied to trunk. Can you get a build on builder.blender.org newer than rev.54745 and see if it solved your problem?
I couldn't get your file to work even using the RRR1 line (console error saying that buffer is not empty). I'm not sure how to test it then%%%

%%%Hi Kevin. The patch I mention was finally commitied to trunk. Can you get a build on builder.blender.org newer than rev.54745 and see if it solved your problem? I couldn't get your file to work even using the RRR1 line (console error saying that buffer is not empty). I'm not sure how to test it then%%%

%%%hi, actually if you could make a demo file using ImageRender and using the image in a plane in the scene it will be easier to debug/test this. Specially because the error I'm getting in your script is related to the ImageToArray part of it%%%

%%%hi, actually if you could make a demo file using ImageRender and using the image in a plane in the scene it will be easier to debug/test this. Specially because the error I'm getting in your script is related to the ImageToArray part of it%%%

%%%any update on this?%%%

%%%any update on this?%%%
Member

%%%It looks like the alpha framebuffer is disabled by default (r58799). However, after enabling it, I was still getting 255 for the alpha value. I checked my context in gDEBugger, and according to it I had 8 bits of alpha for my framebuffer. May be some other issue.%%%

%%%It looks like the alpha framebuffer is disabled by default (r58799). However, after enabling it, I was still getting 255 for the alpha value. I checked my context in gDEBugger, and according to it I had 8 bits of alpha for my framebuffer. May be some other issue.%%%
Member

%%%It looks like a combination of re-enabling the alpha and changing the setBackground in ImageRender's constructor to set an alpha value of 0 fixes the problem. It looks like the alpha framebuffer support was disabled in r56912 to fix a bug. Will need to ask around to figure out the best way to handle this.%%%

%%%It looks like a combination of re-enabling the alpha and changing the setBackground in ImageRender's constructor to set an alpha value of 0 fixes the problem. It looks like the alpha framebuffer support was disabled in r56912 to fix a bug. Will need to ask around to figure out the best way to handle this.%%%

%%%A duplicate (with more test files) was posted here: https://projects.blender.org/tracker/?func=detail&atid=306&aid=37396&group_id=9.%%%

%%%A duplicate (with more test files) was posted here: https://projects.blender.org/tracker/?func=detail&atid=306&aid=37396&group_id=9.%%%

Added subscriber: @ucupumar

Added subscriber: @ucupumar

any news on this?

any news on this?
Member

◀ Merged tasks: #37396.

◀ Merged tasks: #37396.

Just some update on that: at some point we fixed that and committed the fix to master but this introduced another issue. So the fix is there, but it may be need to be done optional.

Just some update on that: at some point we fixed that and committed the fix to master but this introduced another issue. So the fix is there, but it may be need to be done optional.
Member

Added subscriber: @brita

Added subscriber: @brita
Member

@dfelinto so the fix is in master or not? and what is the new issue?

@dfelinto so the fix is in master or not? and what is the new issue?

@dfelinto what kind of issue is that?

@dfelinto what kind of issue is that?

Original commit: 1cdaf1e329
Related issue: a3b47ede17
Reverted commit: 6adec303db

Original commit: 1cdaf1e329 Related issue: a3b47ede17 Reverted commit: 6adec303db

Added subscriber: @panzergame

Added subscriber: @panzergame

@dfelinto: Is this fixed ?

@dfelinto: Is this fixed ?
Member

Added subscribers: @benoit-2, @JorgeBernalMartinez

Added subscribers: @benoit-2, @JorgeBernalMartinez
Member

In #32175#343881, @panzergame wrote:
@dfelinto: Is this fixed ?

I think it is fixed in @BenoitBolsee decklink branch but it is not merged in master yet

> In #32175#343881, @panzergame wrote: > @dfelinto: Is this fixed ? I think it is fixed in @BenoitBolsee decklink branch but it is not merged in master yet
Member

Added subscriber: @BenoitBolsee

Added subscriber: @BenoitBolsee
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Aaron Carlisle self-assigned this 2019-06-29 02:12:21 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#32175
No description provided.