Jump to content

engine update from script


photo

Recommended Posts

we would like a feature which could do an engine render update from the script

like in script init()

{

   forloop(int i=0;5){

      LightOmni omni=new LightOmni();

      render_world();

      .....................

  }

}

 

render_world() will render the engine for just one frame. it's useful for some cases like getProceduralTextureImage...etc those function have to be rendered one frame to get the correct image.

 

 

Link to comment

Hi,

Unfortunately right now we have no plans to add such feature.

Anyway, please describe in more details what do you want to do, maybe we can provide a workaround.

Sorry for the inconvenience caused.

Link to comment

Hi,

 

Unfortunately right now we have no plans to add such feature.

 

Anyway, please describe in more details what do you want to do, maybe we can provide a workaround.

 

Sorry for the inconvenience caused.

just a example:

int init(){

 

forloop (int i=0;5){

   LightOmni newLight=add_editor(new LightOmni());

   newLight.setPosition(vec3(i,0,0));

   Image image=new Image();

   //now use renderimage2d to render the screen to image

   renderImage2D(.....)

   image.save(format("%i.dds",i));

}

}

you can see those lights added on the dds file but no shadow. it might be not actually updated in the scene so they couldn't be rendered.

Link to comment

Hi,

 

You can separate code with creating nodes and other with rendering into image. And execute second block in next update. For example, using script thread:

int init(){
 thread([]() {
      LightOmni newLight=add_editor(new LightOmni());
      newLight.setPosition(vec3(i,0,0));
      Image image=new Image();
      // wait one frame to render new node
      wait;
      renderImage2D(.....)
      image.save(format("%i.dds",i));
 });
}
Link to comment

Hi there!

 

It looks like a bug inside renderNode2D to me as it must render shadows properly without any delays. Also, if you're worrying about node not being updated in the scene, use can use engine.world.updateSpatial function for such cases.

Link to comment

i think properly rendering and node updates are seperated threads? so when renderimage2d it don't know there is a new light in the scene?

Link to comment

Hi,

 

No, world update and render routines are in the same thread. Unless you create new node in flush (which could be in separate thread depending on the value of physics_threaded console variable), there'll be no issues like that.

Link to comment
×
×
  • Create New...