InitRender called twice (XMB)

On 27/07/2013 at 03:23, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   13 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
Hi,

When i use my material with the physical renderer, InitRender is called, then FreeRender, then apparently on another instance InitRender and then the rendering starts.

Does anyone know if this is normal?

I want to do costly computations before the rendering starts but i don't know how to distinguish the two cases.

Any advice? Thanks in advance.

cheers
Michael

P.S. i tried it only in r13.

On 28/07/2013 at 10:57, xxxxxxxx wrote:

Well may be the first InitRender/FreeRender is used for something like Material Preview ?
Have you tested INITRENDERFLAG_PREVIEWRENDER in flags ?

On 28/07/2013 at 13:43, xxxxxxxx wrote:

Could also be prepass or video post.

On 29/07/2013 at 01:50, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Well may be the first InitRender/FreeRender is used for something like Material Preview ?Have you tested INITRENDERFLAG_PREVIEWRENDER in flags ?

I don't think it is the Material Preview because InitRender is called right after hitting the render button.

Just the INITRENDERFLAG_TEXTURES flag is set. And actually i don't see any difference in the parameters in InitRenderStruct.

Not sure if it is a prepass or vp thing since it works fine with the normal renderer. Just switching to physical results in two calls afterwards.

Anyway i think i should implement some sort of caching to disk since it could be relatively easily done and would also work around this problem.

On 29/07/2013 at 01:57, xxxxxxxx wrote:

I can confirm that it happens (tried in R13, too).

The actual reason, I'm not sure of. I guess, when the Physical Renderer clones the document, the material preview renderings are kicked off one more time.

Tips:
- Check for INITRENDERFLAGS (ok, you already did this)
- Check for the document in the InitRenderStruct, see what it is

On 01/08/2013 at 02:39, xxxxxxxx wrote:

Hi Jack. Thanks for checking!
You are right. The document (InitRenderStruct::doc) is different in the two calls. Also the mat->GetDocument() pointer changes.
I don't understand why there would be another copy of the document (editor render). Perhaps i should report it as a bug.