Author Topic: Basic Scripts  (Read 2299 times)

2019-05-07, 06:57:38

aaouviz

  • Active Users
  • **
  • Posts: 1005
    • View Profile
    • Another Angle 3D
Hi All,

I'm a total noob when it comes to scripting (or anything advanced in 3ds max, tbh)... So apologies for the query

I'm wondering how I might go about either finding or somehow creating a script that when activated toggles (either on or off) the Corona Global Volume Material.

I've recently started using Pulze scene manager (from half a days usage I can recommend, despite 1 crash). In some views I'd like the scene to have fog, other scenes I'd like it off. I don't think Pulze has the ability to toggle this option other than saving and loading render settings or - as I'm hoping to do - with a script.

Any tips or pointers much appreciated!
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2019-05-07, 07:38:13
Reply #1

Njen

  • Active Users
  • **
  • Posts: 557
    • View Profile
    • Cyan Eyed
First assign a variable to the current renderer to easily access it:
Code: [Select]
global ren = renderers.currentThen you can list all of the properties of any Max object:
Code: [Select]
showProperties renThen you can search for a key word to find the property you want to change, for example searching for "volume" Got me these:
Code: [Select]
.globalVolumeMtl (enviro_globalVolumeMaterial) : material
.globalVolumeMtl_use (enviro_useGlobalVolumeMaterial) : boolean
It's the second one you need, so to enable to fog, you just need:
Code: [Select]
ren.globalVolumeMtl_use = true

2019-05-07, 08:36:40
Reply #2

aaouviz

  • Active Users
  • **
  • Posts: 1005
    • View Profile
    • Another Angle 3D
Thanks mate. The script works an absolute treat! (Can't get Pulze to recognise it though, sadly)

Thanks again
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2019-05-22, 12:59:58
Reply #3

aaouviz

  • Active Users
  • **
  • Posts: 1005
    • View Profile
    • Another Angle 3D
Hi Njen,

How about if I want to toggle between Path Tracing and UHD Cache in the render settings? Think this is possible?

Thanks in advance for any tips! :D
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2019-05-22, 20:39:23
Reply #4

Njen

  • Active Users
  • **
  • Posts: 557
    • View Profile
    • Cyan Eyed
Yup this is quite easy to do, in fact, I have already written something like this for my own suite of tools. I chopped out the relevant code that you can use. Feel free to add this rollout to what ever custom tool suite you are developing:

Code: [Select]
rollout ro_lightControl "Light Control"
(
button btn_lcRendererSetupUHDCache "Renderer Setup: UHD Cache" width:146 height:18 pos:[3,10]
button btn_lcRendererSetupPathTracing "Renderer Setup: Path Tracing" width:147 height:18 pos:[151,10]

fn defaultRenderSettings =
(
set animate off
renderSceneDialog.close()
renderers.current = CoronaRenderer()
global ren = renderers.current
--showproperties ren
-- Set up any other custom general settings you wish here.
-- For example, I like to turn off 'Auto Bump', so I added this line:
--ren.geometry_displace_useAutoBump = false
)

on btn_lcRendererSetupUHDCache pressed do
(
defaultRenderSettings()

ren.shading_secondarySolver = 4
ren.gi_uhdcache_preset = 1
)

on btn_lcRendererSetupPathTracing pressed do
(
defaultRenderSettings()

ren.shading_secondarySolver = 1
)
)