BGE Material - Alpha Blend: Add - not respecting object.color alfa value #28888

Closed
opened 2011-10-12 12:23:20 +02:00 by Pavel Křupala · 10 comments

Category: Rendering

%%%Using:
Blender 2.59.4 with Addons-Contrib, Multi-Branch Merge from GraphicAll.org
Built with MSVC 2008 Express and Scons:

GSOC Pepper Branch merged to trunk!
GSOC Particles-2010 Branch merged to trunk!
GSOC BGE:Recast & Detour-2010 Branch merged to trunk!
GSOC Radish Branch merged to trunk!
Texface and Material game engine patch now in trunk!

Material:
Shadeless
Game Settings: Backface - Off, Alpha Blend: Add, Face Orientation: Billboard
Options: Object Color: ON
Transparency: On, Z Transparency, Alpha 0.0
1 Texture:
PNG with alfa channel, UV mapping on Plane, Influence: Color 1.0, Alfa 1.0

every time in script you change color through python script in game engine like:
obj.color = [1.0, 1.0, 1.0, 0.5]
Alpha Blend mode ADD does NOT respect alpha value of given color.
Every other Alpha Blend option does respect the alpha and works fine.

see .blend file, just layer 2 and press P to see the difference between 2 modes of Alpha Blending


PC:
i7-2600K
8GB Kingston Ram
Windows 7
nVidia GTX 560%%%

**Category**: Rendering %%%Using: Blender 2.59.4 with Addons-Contrib, Multi-Branch Merge from GraphicAll.org Built with MSVC 2008 Express and Scons: GSOC Pepper Branch merged to trunk! GSOC Particles-2010 Branch merged to trunk! GSOC BGE:Recast & Detour-2010 Branch merged to trunk! GSOC Radish Branch merged to trunk! Texface and Material game engine patch now in trunk! -------------- Material: Shadeless Game Settings: Backface - Off, Alpha Blend: Add, Face Orientation: Billboard Options: Object Color: ON Transparency: On, Z Transparency, Alpha 0.0 1 Texture: PNG with alfa channel, UV mapping on Plane, Influence: Color 1.0, Alfa 1.0 every time in script you change color through python script in game engine like: obj.color = [1.0, 1.0, 1.0, 0.5] Alpha Blend mode ADD does NOT respect alpha value of given color. Every other Alpha Blend option does respect the alpha and works fine. see .blend file, just layer 2 and press P to see the difference between 2 modes of Alpha Blending ---------- PC: i7-2600K 8GB Kingston Ram Windows 7 nVidia GTX 560%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%Hi Pavel,
it's not clear to me whether this is a new bug, or a functionality that was always missing.

Can you provide a sample file in 2.59 (or even 249)?
Also you don't need to zip the files. Saving the file with "compressed" turned on should be enough.%%%

%%%Hi Pavel, it's not clear to me whether this is a new bug, or a functionality that was always missing. Can you provide a sample file in 2.59 (or even 249)? Also you don't need to zip the files. Saving the file with "compressed" turned on should be enough.%%%
Author

%%%Hi, i cant answer the question if its bug or missing functionality, but sample file is in attachment in previous post that was done with 2.59.4 with the bge material patch, because original 2.59 version doesn't have the patch included.
I belive that it is a bug because when I was programming pure OpenGL i used transparency too with glBlendFunc(GL_SRC_ALPHA,GL_ONE) and GL_RGBA, Even if I had to manualy sort the particles to display the farthest first (sort by depth), but remember setting alpha value for particles/planes/textures was working...

In the demo file the correct behavior can be seen on the left particles - they are going up and fading (because of setting alpha value)
right particle system is set with Alpha blend ADD mode and alpha is set too, but you can see that particles are not fading out%%%

%%%Hi, i cant answer the question if its bug or missing functionality, but sample file is in attachment in previous post that was done with 2.59.4 with the bge material patch, because original 2.59 version doesn't have the patch included. I belive that it is a bug because when I was programming pure OpenGL i used transparency too with glBlendFunc(GL_SRC_ALPHA,GL_ONE) and GL_RGBA, Even if I had to manualy sort the particles to display the farthest first (sort by depth), but remember setting alpha value for particles/planes/textures was working... In the demo file the correct behavior can be seen on the left particles - they are going up and fading (because of setting alpha value) right particle system is set with Alpha blend ADD mode and alpha is set too, but you can see that particles are not fading out%%%
Member

%%%I am not sure this is actually a bug. The way add alpha works is to use a blending function that adds the source and destination RGBA values together. The reason changing the source alpha value (the particle) doesn't do anything is because the destination alpha is always 1. After the values are added together, they get clamped into the 0 to 1 range. This means using add alpha, the resulting alpha value will always be 1 regardless of the source alpha.

One problem you are running into with the particle image is that the transparent areas are white. If they are black you actually get circles instead of squares. Not sure if that is a problem with Blender image loading or not. This is also something that affects the viewport, so I don't see that as a BGE bug.%%%

%%%I am not sure this is actually a bug. The way add alpha works is to use a blending function that adds the source and destination RGBA values together. The reason changing the source alpha value (the particle) doesn't do anything is because the destination alpha is always 1. After the values are added together, they get clamped into the 0 to 1 range. This means using add alpha, the resulting alpha value will always be 1 regardless of the source alpha. One problem you are running into with the particle image is that the transparent areas are white. If they are black you actually get circles instead of squares. Not sure if that is a problem with Blender image loading or not. This is also something that affects the viewport, so I don't see that as a BGE bug.%%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Member

Added subscriber: @brita

Added subscriber: @brita
Member

Seems to be missing functionality.
Adding to the TODO and closing.

Seems to be missing functionality. Adding to the TODO and closing.
Member

Changed status from 'Archived' to: 'Open'

Changed status from 'Archived' to: 'Open'
Member

misread as a TODO, according to kupoman's comment, this is working as intended, so not a bug.

misread as a TODO, according to kupoman's comment, this is working as intended, so not a bug.
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
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
4 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#28888
No description provided.