Page MenuHome

Import Images As Planes: Automatically generate the transparent material nodes system when enabling "Use Alpha", for Cycles.
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Jul 29 2015, 8:35 PM.

Details

Summary
  • removed two options from Cycles Materal settings during import ("Diffuse & Transparent", "Emission & Transparent")
  • nodetree creation stays the same, but transparent BSDF (along the other needed nodes) is now added when Import Option "Use Alpha" is checked

Diff Detail

Event Timeline

Philipp Oeser (lichtwerk) retitled this revision from to Import Images As Planes: set "use_alpha" for images in cycles as well.
Philipp Oeser (lichtwerk) updated this object.
Bastien Montagne (mont29) requested changes to this revision.Aug 8 2015, 8:33 AM
Bastien Montagne (mont29) edited edge metadata.

Thanks for the patch, but I do not quite understand its meaning… 'use_transparency' is an image-only setting, without materials, hence it shall absolutely not be affected by material settings imho.

This revision now requires changes to proceed.Aug 8 2015, 8:33 AM

@Bastien Montagne (mont29): I think users would expect the addon to import the image as well as set up the appropriate material/texture/image/nodetree for them.
In case of BI, the addon also sets use_alpha (along with other settings) for the image [and this option "Use Alpha" is also grouped under "Material Settings" in the addon UI].

This patch just aims at doing the same thing for cycles...right now: user chooses a XXX_TRANSPARENT material but doesnt get transparency in render nor UVEditor right away (which seems counter-intuitive, no?). Did you see report T45602: Import Images as Planes corrupts transparent images since 2.74?

Alternative suggestion: maybe we should expose an "Use Alpha" option in the addon UI for cycles as well (instead of doing it implicitly like in this patch)?

OK, see the point, but think you took the issue by the wrong end then. :)
What you probably want to do here is to change how Cycles mat is generated to match behavior of BI mat generation (that is, remove the Diffuse & Transparent, and Emission & Transparent shading options, and automatically use them when 'use_transparency' import option is set).

@Bastien Montagne (mont29): could do that (not sure if this is more intuitive though...)
@Florian Meyer (testscreenings): any opinions (since it was you who first added this)? get rid of "& Transparent" (in favour of "Use Alpha" option)?

Philipp Oeser (lichtwerk) edited edge metadata.

did as @Bastien Montagne (mont29) suggested:

  • removed two options from Cycles Materal settings ("Diffuse & Transparent", "Emission & Transparent")
  • nodetree creation stays the same, but transparent BSDF (along the other needed nodes) is now added when Import Option "Use Alpha" is checked
  • use_alpha (along alpha_mode, use_fields) is correctly set for the image now -- calling existing "set_image_options(image)" for this -- formerly ignored when using cycles

[ note: version 1 of this patch was against an older revision, so didnt notice "Use Alpha" was already exposed in the UI already for cycles as well... -- just to clear up my previous comment ]

Philipp Oeser (lichtwerk) retitled this revision from Import Images As Planes: set "use_alpha" for images in cycles as well to Import Images As Planes: set image options ("use_alpha", ...) for images in cycles as well.Aug 23 2015, 5:11 PM
Philipp Oeser (lichtwerk) updated this object.
Philipp Oeser (lichtwerk) edited edge metadata.
Bastien Montagne (mont29) edited edge metadata.

Aside from minor note below, LGTM. Do you have commit access to addons repo?

io_import_images_as_planes.py
479

No need to call that here, it’s already called in all cases in import_images()

This revision is now accepted and ready to land.Aug 23 2015, 5:37 PM
Bastien Montagne (mont29) retitled this revision from Import Images As Planes: set image options ("use_alpha", ...) for images in cycles as well to Import Images As Planes: Automatically generate a transparent material nodes system when enabling 'use_alpha', for Cycles..Aug 23 2015, 5:38 PM
Bastien Montagne (mont29) edited edge metadata.
Philipp Oeser (lichtwerk) retitled this revision from Import Images As Planes: Automatically generate a transparent material nodes system when enabling 'use_alpha', for Cycles. to Import Images As Planes: Automatically generate the transparent material nodes system when enabling "Use Alpha", for Cycles..
Philipp Oeser (lichtwerk) updated this object.

review by mont29: removed duplicate call to set_image_options() -- doh!

Philipp Oeser (lichtwerk) marked an inline comment as done.Aug 23 2015, 10:27 PM

@Bastien Montagne (mont29): I have commit access but something is wrong with my git atm. [not letting me push... I'll sort that out...].
You can push too if you want. Thanx for review anyway!

io_import_images_as_planes.py
82

doh! :)

Philipp Oeser (lichtwerk) marked an inline comment as done.Aug 23 2015, 10:28 PM
This revision was automatically updated to reflect the committed changes.