R16 Material Reflectance [LIMITATION]
-
On 13/04/2015 at 06:16, xxxxxxxx wrote:
I just realised that R16 has broke our Python plugin as it relies on access to specular and reflection..
Damnit!
Are there any workarounds/hacks or at the very least plans to implement access into the API?
I know it is available in the C++ api but that would mean refactoring everything to that..
-
On 13/04/2015 at 08:12, xxxxxxxx wrote:
Hi,
The Python API doesn't unfortunately give access to the newly added specular and reflection layers in R16.
But how (classes? functions?) were you accessing these in pre-R16 Cinema? In what type of Python plugin were you accessing these? -
On 13/04/2015 at 14:53, xxxxxxxx wrote:
Hi Yannick,
Just the usual method i suppose for R15 and below - grab the material from the doc ( or create it ) and set the specular and reflection channel properties directly:
if mat.GetType() == c4d.Mmaterial mat[c4d.MATERIAL_SPECULAR_HEIGHT] = 1 mat[c4d.MATERIAL_SPECULAR_BRIGHTNESS] = 1 mat[c4d.MATERIAL_USE_ENVIRONMENT] = 0
That type of thing..
Any possibility of the new reflectance properties being implemented in R16 anytime soon?
The only potential issue with that is that commands such as New to create new layers inside Reflectance, and things like that, would have to also be accessible in Python, or at least have methods for them..
[edit] The plugins are an import/export suite between 3dsMax and C4D, so we import scenes that have been exported from Max via our exporter, and bring them into C4D whilst setting up all materials to be as closely matched as possible to what they were inside Max.
So unless there is some hacky way around this it's pretty much ESSENTIAL that we can still access these things..
[edit 2] Had to edit the above code as i accidentally used the vray material version, fixed.
-
On 14/04/2015 at 06:27, xxxxxxxx wrote:
Hi,
Originally posted by xxxxxxxx
Any possibility of the new reflectance properties being implemented in R16 anytime soon?
I'm afraid it's not be possible to create reflection and specular layers with the R16 Python API. You'll have to rely on C++ for this.
-
On 14/04/2015 at 10:15, xxxxxxxx wrote:
Thanks Yannick but you've told me that twice already, even though i've made it clear in my first post i already know that
What i'm asking is - is there any view of it being implemented into Python in the near future, because it's broken our plugin suite and probably others too, and to go from full material specular and reflection access, to none at all, is not good..
-
On 14/04/2015 at 10:46, xxxxxxxx wrote:
Sorry, I had not formulate well my answer in my previous post.
This seems an important blocking issue, strange it's not been reported earlier. I'll forward it to the developement team, but I fear it's too late for R16... -
On 14/04/2015 at 11:02, xxxxxxxx wrote:
Thanks Yannick - Yes it IS an important blocking issue.. The plugins we are developing we hope will ease the transition from 3dsMax to Cinema4D and also offers VRAY material and settings conversion, so potentially a really important bridge between the two apps..
The plugins as they were when i recently took over development, were written in Python, because it was more than enough for this type of functionality, and C4D Python encryption meant we could wrap them up as fully fledged plugins. Refactoring to C++ is possible but would be a lot of work.. And really, it doesn't make sense to not include Reflectance in the Python API when pretty much everything else is there, it's just silly
-
On 15/04/2015 at 04:03, xxxxxxxx wrote:
Hi,
I got the confirmation that it's too late to add the support for reflection layers in R16 :frowning2:.
But it will be added in the future . -
On 15/04/2015 at 06:31, xxxxxxxx wrote:
Okay - thanks for doing that Yannick, much appreciated.
I guess we could look at a C++ solution just for the reflectance element of our plugin. Assuming it's possible and not too inelegant to launch another plugin from Python and do it that way
-
On 20/04/2015 at 07:08, xxxxxxxx wrote:
Hi Eclectrik,
if it is sufficient for you to use the default specular layer you could hardcode the main layer id and then append the constants for the parameters like this:mainLayerId = 526336 mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_BLEND_MODE] = 0 # default specular mix mode -> Normal mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] = c4d.REFLECTION_DISTRIBUTION_GGX mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_ADDITIVE] = 0 # sets attenuation to average
-
On 23/04/2015 at 06:27, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Hi Eclectrik,
if it is sufficient for you to use the default specular layer you could hardcode the main layer id and then append the constants for the parameters like this:mainLayerId = 526336 mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_BLEND_MODE] = 0 # default specular mix mode -> Normal mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] = c4d.REFLECTION_DISTRIBUTION_GGX mat[mainLayerId + c4d.REFLECTION_LAYER_MAIN_ADDITIVE] = 0 # sets attenuation to average
Hi Satara -
That's really useful thank you very much.. How did you find out the ID for the default layer? Atm i'm crawling through the basecontainer for the material, trying to find some clues as to what is what - is there an easier way?
-
On 23/04/2015 at 08:52, xxxxxxxx wrote:
Normally you can drag and drop the parameter labels into the console input field, but for the reflection parameters it does not take the layer id into account.
So in this case I also took the manual approach by iterating through the basecontainer to find the id for a specific reflectance parameter and then subtracted the corresponding constant to get the layer id. -
On 23/04/2015 at 09:13, xxxxxxxx wrote:
Hi,
The C++ API provides the method ReflectionLayer::GetDataID() which gives the data ID in the material container for a layer. It is defined in the API header c4d_reflection.h (all reflection layer data IDs are defined in there too) as this:
Int32 GetDataID() const { return REFLECTION_LAYER_LAYER_DATA + REFLECTION_LAYER_LAYER_SIZE * layerID; }
Where REFLECTION_LAYER_LAYER_DATA is defined as 0x80000 (=524288) and REFLECTION_LAYER_LAYER_SIZE as 0x0200 (=512).
layerId is then easy to calculate :). -
On 24/04/2015 at 00:12, xxxxxxxx wrote:
On a side note, the default reflection layer has the layer ID "4".
import c4d mat = doc.GetActiveMaterial() base = c4d.REFLECTION_LAYER_LAYER_DATA + c4d.REFLECTION_LAYER_LAYER_SIZE * 4 print mat[base + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION]
-
On 24/04/2015 at 05:17, xxxxxxxx wrote:
That's great guys thanks a lot for the help, this should be enough to keep things working in the plugin for now.
-
On 25/04/2016 at 10:22, xxxxxxxx wrote:
Super Super thanks a lot guys !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!