Author Topic: Convert to Max Geometry Multiple Scatters  (Read 3415 times)

2024-02-03, 01:44:29

CharlyRT

  • Active Users
  • **
  • Posts: 72
    • View Profile
Hi there, I received some Models from a client where it has more than 200 scatters objects and I need to convert them to mesh, is there a way to convert them in batch or an easy way to do it, like I said, theres more than 200 scatters, its gonna take a lot of time to do this.

It will be great to have this operation in the Lister too.

2024-02-05, 10:20:20
Reply #1

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 558
    • View Profile
Hi,

The closest you can get is to use maxscript. After a quick chat with devs, there seems to be no option to call the convert to max geometry function from maxscript.
So there is only some rough and ugly way to convert them.

But why do you want them converted?
Do you want to modify the scattered instances?
If you can provide some more details, I may be able to help you better.
Aram Avetisyan | chaos-corona.com
Chaos Corona Support Representative | contact us

2024-02-05, 13:26:17
Reply #2

pokoy

  • Active Users
  • **
  • Posts: 1861
    • View Profile
Hi there, I received some Models from a client where it has more than 200 scatters objects and I need to convert them to mesh, is there a way to convert them in batch or an easy way to do it, like I said, theres more than 200 scatters, its gonna take a lot of time to do this.

It will be great to have this operation in the Lister too.
Making a mesh snapshot is probably a fast way to do it (Choose the Scatter object you want to convert > Top Menu > Tools > Snapshot, choose Mesh), but it would not retain the individual instances, every Scatter object would become a mesh, not sure if that's what you're after. The advantage is that you can select all of the Scatter objects and when choosing Snapshot it will convert all of them in one go.

2024-02-05, 19:17:24
Reply #3

CharlyRT

  • Active Users
  • **
  • Posts: 72
    • View Profile
Hi there, I received some Models from a client where it has more than 200 scatters objects and I need to convert them to mesh, is there a way to convert them in batch or an easy way to do it, like I said, theres more than 200 scatters, its gonna take a lot of time to do this.

It will be great to have this operation in the Lister too.
Making a mesh snapshot is probably a fast way to do it (Choose the Scatter object you want to convert > Top Menu > Tools > Snapshot, choose Mesh), but it would not retain the individual instances, every Scatter object would become a mesh, not sure if that's what you're after. The advantage is that you can select all of the Scatter objects and when choosing Snapshot it will convert all of them in one go.

Thanks but this.... didnt do anything, it created a new scatter object with same properties, no new meshes :(

2024-02-05, 19:30:45
Reply #4

CharlyRT

  • Active Users
  • **
  • Posts: 72
    • View Profile
But why do you want them converted?
If you can provide some more details, I may be able to help you better.

Guys Come on? really? I know that you need a good reason in order to prioritize updates or make adjustments but..... Does it really matter why I need to convert them?
I need to convert them as a favor to my client that provide me these models, They dont have anyway to do this, and they need them as mesh.

What about if Im modeling forniture or something that in certain point I want to sell it on 3dsky or wherever, I need to provide a model so everyone can open it without any problem if they dont have certain plugins in order to avoid incompatibility.

This is something that I can do really easy and fast in ForestPack/RailClone
This could be something that you could improve, an easy way to convert multiple or every scatter in the scene as a mesh in order to use them if we dont have Chaos Scatter or any other special reason.
« Last Edit: 2024-02-05, 19:38:14 by RTstudio »

2024-02-06, 08:44:11
Reply #5

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 558
    • View Profile
But why do you want them converted?
If you can provide some more details, I may be able to help you better.

Guys Come on? really? I know that you need a good reason in order to prioritize updates or make adjustments but..... Does it really matter why I need to convert them?
I need to convert them as a favor to my client that provide me these models, They dont have anyway to do this, and they need them as mesh.

What about if Im modeling forniture or something that in certain point I want to sell it on 3dsky or wherever, I need to provide a model so everyone can open it without any problem if they dont have certain plugins in order to avoid incompatibility.

This is something that I can do really easy and fast in ForestPack/RailClone
This could be something that you could improve, an easy way to convert multiple or every scatter in the scene as a mesh in order to use them if we dont have Chaos Scatter or any other special reason.

The question was not coming out from curiosity, but from trying to understand what you are after, and trying to be helpful.

Converting Scatter geometry to Max, even for one scatter object, can be very taxing for the scene - even if the instanced mesh can be simple, creating a large number of objects in the scene, which the conversion does, will most probably lead to scene freeze. I am not talking about hundreds of scatters. This will surely be the same for ForestPack conversion (if it does not attach all the scattered geometry into one object).

Unfortunately there is not way to do this in batch. I was trying to create a batch script for you with maxscript for this, but seems there is no way to do it.
This will be registered as a feature request, but this is not something that is regularly done, I believe.
If having the geometry "on place" was the end goal (given the screenshots, I think these are linear scatters), maybe other ways of modeling could be beneficial, e.g. the array modifier (which has solid scattering options too), which would later be easily converted into mesh.

I don't see any other option than to convert them one by one, I am afraid.
Aram Avetisyan | chaos-corona.com
Chaos Corona Support Representative | contact us

2024-02-06, 08:59:18
Reply #6

pokoy

  • Active Users
  • **
  • Posts: 1861
    • View Profile
Quote
Thanks but this.... didnt do anything, it created a new scatter object with same properties, no new meshes :(

Oh sorry, I assumed it must work since it works with anything else that produces/instances geometry procedurally. Seems Scatter was deliberately blocked from passing geometry to these methods in Max.

@Aram
Not passing geometry to other tools in Max makes no sense, especially since you provide a way to convert Scatter instance to Max instances. Please just make sure it's passing its output internally, no need for additional scripts then.

2024-02-06, 09:42:51
Reply #7

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 558
    • View Profile
Quote
@Aram
Not passing geometry to other tools in Max makes no sense, especially since you provide a way to convert Scatter instance to Max instances. Please just make sure it's passing its output internally, no need for additional scripts then.

I am not sure what you mean. What I was saying, is that e.g. array modifier is placing the geometry as-is, and it can be readily converted to editable mesh/poly. Scattering plugins on the other hand, place/show instances in the viewport, generate mesh on the render time, there is no readily available/interactive geometry to be converted. In fact, not even full mesh display scatter can be converted to editable poly. And when listening the maxscript when converting scatter geometry into max, it actually reads the data (transform) of the instances and creates the instances one by one. That is another reason why it can take very long times to do the conversions, not mentioning the display of high poly meshes in the viewport.
Aram Avetisyan | chaos-corona.com
Chaos Corona Support Representative | contact us

2024-02-06, 11:21:04
Reply #8

Frood

  • Active Users
  • **
  • Posts: 1920
    • View Profile
    • Rakete GmbH
Hi,

This could be something that you could improve, an easy way to convert multiple or every scatter in the scene as a mesh

I agree. We need interfaces for scatter and CoronaCamera at least to be able to script them properly. Here is another (ugly) one for you: select the scatter objects you want to convert and then run this snippet, I hope it works for you:

Code: [Select]
(
AInterface =  (dotNetClass "Autodesk.Max.GlobalInterface").Instance
cPanel= (windows.getHWndData (AInterface.UtilGetCoreInterface16()).CommandPanelRollup.Hwnd)[7]
max modify mode
sObjects=for o in selection where (classof o==ChaosScatter) collect o
for o in sObjects do (
format "Processing '%'\n" o.name
select o
ConvertButton=windows.getChildHWND cPanel "Convert to Max geometry"
windows.sendMessage ConvertButton[1] 0x201 0 0
windows.sendMessage ConvertButton[1] 0x202 0 0
-- optional, deletes the scatter object after creating meshes:
-- delete o
)
)



This will be registered as a feature request, but this is not something that is regularly done, I believe.

Sorry, but if Corona/CScatter will call itself professional, there just has to be proper(!) script access for everything. Those mentioned ForestPack options aren't there because iToo was bored and implemented them Friday evening as a chips'n red wine job, but because users need and requested it. At the very least, converting to mesh has to be implemented into the scatter lister as an option (edit: of) the actions column. But script access is superior because you do not depend on any UI.


Good Luck



« Last Edit: 2024-02-06, 11:55:27 by Frood »
Never underestimate the power of a well placed level one spell.

2024-02-06, 12:25:59
Reply #9

pokoy

  • Active Users
  • **
  • Posts: 1861
    • View Profile
Quote
@Aram
Not passing geometry to other tools in Max makes no sense, especially since you provide a way to convert Scatter instance to Max instances. Please just make sure it's passing its output internally, no need for additional scripts then.

I am not sure what you mean. What I was saying, is that e.g. array modifier is placing the geometry as-is, and it can be readily converted to editable mesh/poly. Scattering plugins on the other hand, place/show instances in the viewport, generate mesh on the render time, there is no readily available/interactive geometry to be converted. In fact, not even full mesh display scatter can be converted to editable poly. And when listening the maxscript when converting scatter geometry into max, it actually reads the data (transform) of the instances and creates the instances one by one. That is another reason why it can take very long times to do the conversions, not mentioning the display of high poly meshes in the viewport.

I think if a user needs/wants to convert a scatter object to a mesh he's probably aware of the mesh polycount, there is no need to 'protect' him from a wrong choice if the choice was a deliberate decision or needed for whatever reason in the first place.
If the mesh is shown in the viewport it already *exists* as a mesh, Corona is just not passing the data internally (Frood is hopefully proving me wrong with his script above, didn't test).

I guess the story went like this:
1. Corona develops a Scatter plugin, doesn't add passing geometry data internally because of either being overly protective (Scatter needs to be purchased/installed) or because no one thought of it.
2. Users request an option to convert to Max instances, it is added. Because of that, no one thinks passing geometry internally is needed anymore so it's left in that state.

We might have valid ideas and requests that are not making sense for developers/support. A user might have to hand out his scene to another studio that doesn't use Corona. Or I might want to convert all my Scatter objects because I know I'm going to have to re-render the scene in the coming years and I don't want to lose the scene's content to whatever the future holds for me as a cllient or Corona as a software/company. There are many reasons why I might want to use meshes or need them.

Also, not everyone has access to latest Max tools like Array - for example, I personally don't as I didn't go with the SAAS licensing for Max and am stuck with Max 2022.

2024-02-06, 23:36:24
Reply #10

CharlyRT

  • Active Users
  • **
  • Posts: 72
    • View Profile

Here is another (ugly) one for you: select the scatter objects you want to convert and then run this snippet, I hope it works for you:

Code: [Select]
(
AInterface =  (dotNetClass "Autodesk.Max.GlobalInterface").Instance
cPanel= (windows.getHWndData (AInterface.UtilGetCoreInterface16()).CommandPanelRollup.Hwnd)[7]
max modify mode
sObjects=for o in selection where (classof o==ChaosScatter) collect o
for o in sObjects do (
format "Processing '%'\n" o.name
select o
ConvertButton=windows.getChildHWND cPanel "Convert to Max geometry"
windows.sendMessage ConvertButton[1] 0x201 0 0
windows.sendMessage ConvertButton[1] 0x202 0 0
-- optional, deletes the scatter object after creating meshes:
-- delete o
)
)

Good Luck

Ohhhhh myyyyyy Goooooood
Thank u so much Frood!!!!
This worked beautifully
Of course it took a little while converting 240 objects, but man it didnt matter, Preferable to wait 2 min instead of 1 full day doing this manually.
« Last Edit: 2024-02-07, 00:17:53 by RTstudio »

2024-02-07, 00:05:34
Reply #11

CharlyRT

  • Active Users
  • **
  • Posts: 72
    • View Profile
The question was not coming out from curiosity, but from trying to understand what you are after, and trying to be helpful.

I dont know why its so difficult to understand "I need to convert multiple scatters into mesh", but ok

Converting Scatter geometry to Max, even for one scatter object, can be very taxing for the scene - even if the instanced mesh can be simple, creating a large number of objects in the scene, which the conversion does, will most probably lead to scene freeze. I am not talking about hundreds of scatters. This will surely be the same for ForestPack conversion (if it does not attach all the scattered geometry into one object).

You are assuming that because of this, we dont need to convert scatters on mesh? Of course that we would consider that this will provoque frezzes or even crashes, but I wouldnt mind if this works in the end, ForestPack takes some cautions to this, placing new objects on new layer and displays as box or even hiding them, but it can be done.

Unfortunately there is not way to do this in batch. I was trying to create a batch script for you with maxscript for this, but seems there is no way to do it.
This will be registered as a feature request, but this is not something that is regularly done, I believe.
If having the geometry "on place" was the end goal (given the screenshots, I think these are linear scatters), maybe other ways of modeling could be beneficial, e.g. the array modifier (which has solid scattering options too), which would later be easily converted into mesh.

I don't see any other option than to convert them one by one, I am afraid.

Thank u to take your time to try this, fortunately Frood achieve this beautifuly, here are some suggestions from Corona Developers.

Use the script that Frood wrote, test it, make it your own if you will and create a button on the toolbar, put some advice that will provoque frezzes or crashes or whatever. But please add it!!!

Here is the ressult, there were 240 scatters, it didnt took too much time to convert them and it didnt frezzes or crashes.
« Last Edit: 2024-02-07, 00:10:06 by RTstudio »

2024-02-07, 08:28:21
Reply #12

Aram Avetisyan

  • Corona Team
  • Active Users
  • ****
  • Posts: 558
    • View Profile
I am very happy that Frood's script help you a lot. He cracks it when it seems un-doable.

Please understand that all the communication and questions are for trying to be helpful to the users.

On the other note: Where the objects created by having 240 separate splines and 240 separate scatters? Wouldn't it be easier to attach all the splines and have 1 spline, and just 1 scatter? From the attached screenshots, I think that would very well work and there would have not been a need to convert so many scatters.

For the other requests - yes, we are aware of them, and it would be great to have proper host application language (maxcript) support for all the tools. This relates to the development process and everything is thoroughly considered and prioritize, to meet the release cycles too. Important part of this is what has been requested by many users and what would bring the biggest impact for as many Corona users as possible.
Aram Avetisyan | chaos-corona.com
Chaos Corona Support Representative | contact us

2024-02-07, 08:56:21
Reply #13

Frood

  • Active Users
  • **
  • Posts: 1920
    • View Profile
    • Rakete GmbH
Hi,

Use the script that Frood wrote, test it, make it your own if you will and create a button on the toolbar

You can do that by your own if you like (just put the code into a macroscript). But that way of "programming" is not the way to go at all, even if it works. What is does, is simply "emulate" being a user who selects the scatters and clicks that "convert" button. If the Corona team would decide to rename the button, it would not work any more. This is all crap, we need a proper maxscript interface for doing it correctly. But in this case (scatter object), that option would perfectly fit into the Corona listener. No need for any additional button, and it would process the scatters way faster.

For the other requests - yes, we are aware of them, and it would be great to have proper host application language (maxcript) support for all the tools.

My point is, that nothing should be developed without initially(!) having in mind to publish important features to maxscript - and doing so :)


Good Luck



Never underestimate the power of a well placed level one spell.

2024-02-09, 00:23:56
Reply #14

CharlyRT

  • Active Users
  • **
  • Posts: 72
    • View Profile
Hi

You can do that by your own if you like (just put the code into a macroscript). But that way of "programming" is not the way to go at all, even if it works. What is does, is simply "emulate" being a user who selects the scatters and clicks that "convert" button. If the Corona team would decide to rename the button, it would not work any more. This is all crap, we need a proper maxscript interface for doing it correctly. But in this case (scatter object), that option would perfectly fit into the Corona listener. No need for any additional button, and it would process the scatters way faster.


I know, I already did that, but not many people will read this post, it will be really useful if they decide to take a look into it and improve it like you said, I hope that Corona Team take notice of this kind of details in the future.

Thanks again for your script, I dont care if it works slow and its not the way to go but it just helps the porpuse that I had in mind.