Itoo Software Forum

Author Topic: Corona render and forest material  (Read 726 times)

Pierre

  • Jr. Member
  • **
  • Posts: 79
    • Studiosezz
Corona render and forest material
« on: August 18, 2015, 11:21:58 AM »
Hello,
Forest material is not supported by corona and the corona material converter is not able to convert this material. Is there a trick or a script for doing this ?
I have a lot of them to do :)
Thank you
Pierre
Studiosezz PARIS
www.studiosezz.com

3dwannab

  • Newbie
  • *
  • Posts: 18
Re: Corona render and forest material
« Reply #1 on: August 18, 2015, 02:01:11 PM »
++1 not sure if this would need to be implemented on Coronas side too. I think I read somewhere on their forum that's the case.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3156
    • iToo Software
Re: Corona render and forest material
« Reply #2 on: August 19, 2015, 10:00:18 AM »
This script may help. It removes Forest Material from the scene, replacing them by their "Base Material" (usually a Standard mat.) which is renderable by Corona:

Code: [Select]
function removeForestMaterial mat parent slot =
(
case (classof mat) of
(
Multimaterial:
(
local i
for i = 1 to (getNumSubMtls mat) do
removeForestMaterial (getSubMtl mat i) mat i
)
Forest_Material:
(
if mat.material1 != undefined then
(
mat.material1.name = mat.name
if parent == undefined then
replaceInstances mat mat.material1
else
setSubMtl parent slot mat.material1
)
)
)
)

function processSceneMaterials =
(
local i
for i = 1 to (sceneMaterials.count) do
(
removeForestMaterial sceneMaterials[i] undefined 0
)
)

processSceneMaterials()

Forest Material is used exclusively for 2D trees, that are not directly supported in Corona. Anyway they can be rendered as standard objects, applying a "Select mesh" or "Edit mesh" to the Forest object, and removing Forest Material with the above script. Some features of billboards as fake shadows or tint will not be available, but at least you can render them.

I hope that helps.
Carlos Quintero
iToo Software