Chaos Corona Forum

General Category => General CG Discussion => Topic started by: Lucas Rodrigues on 2019-05-09, 17:27:00

Title: Show shaded material in viewport always on
Post by: Lucas Rodrigues on 2019-05-09, 17:27:00

Hello friends,.

Is there a way for all created materials to automatically appear in the viewport?
Having to click the "show shader material in the viewport" button every time I create a material is very annoying.

I'm not talking about an option like the show map button on the VP crown convert, I'm talking about an option for the material editor button to always be turned on.
Title: Re: Show shaded material in viewport always on
Post by: Frood on 2019-05-13, 10:47:08
There are various options to deal with this - depends on what you would like to have. You can have

- a button on your personal toolbar to toggle that setting for the material(s) of selected objects (that's what I use)
- as a variant, a button which switches show in viewport on for the materials of selected objects (and maybe another to switch if off)
- or a script which automatically activates show in viewport when assigning a material to an object (sometimes I use this one)
- or a script which always switches it on automatically after loading a scene
- or ... whatever :]

Your choice. I'm not aware of any built in option to achieve this.


Good Luck



Title: Re: Show shaded material in viewport always on
Post by: Lucas Rodrigues on 2019-05-15, 18:58:09

Yes, these options I know. But what I'm looking for is a way to show difuse maps automatically in the viewport when I apply things, I just want to eliminate the need to click a button for that function.
Title: Re: Show shaded material in viewport always on
Post by: Frood on 2019-05-15, 20:32:26
when I apply things


Now, what exactly do you mean here? Connecting a bitmap to a material? Or assign a material? Or something else?


Good Luck



Title: Re: Show shaded material in viewport always on
Post by: Lucas Rodrigues on 2019-05-18, 00:15:54
Please watch the video and you'll understand.
Title: Re: Show shaded material in viewport always on
Post by: Frood on 2019-05-20, 20:10:16
That's what I listed here:

- or a script which automatically activates show in viewport when assigning a material to an object (sometimes I use this one)

Here is my old script, I use almost solely a toggle button now because you cannot generally activate diffuse tex or material display and that's it. On many materials you would rather like to see some completely different map type in the viewport, especially while tweaking. But it should do what you have shown. Throw it in your "scripts\startup" directory or just execute it to test.


Good Luck


Title: Re: Show shaded material in viewport always on
Post by: Lucas Rodrigues on 2019-05-21, 00:57:52
Cool, I'll try. Thanks for sharing
Title: Re: Show shaded material in viewport always on
Post by: Lucas Rodrigues on 2019-05-21, 01:08:04
This script worked PERFECTLY on the first few tests, but now I get this error message. I'm sorry, but I'm totally noob on schedule, I was in doubt about editing the script.
How do I create alternations in code to toggle between diffuse and reflect? gloss for example?
Title: Re: Show shaded material in viewport always on
Post by: Frood on 2019-05-21, 09:36:51
The viewport display is cumbersome to handle outside (and even inside) SME and this tiny script was never meant to be something else but working in the background and activating a basic map display immediately. There is no toggle, not even a button :) Better to do everything else in SME, really. But if you want to play around, these are the texmap properties of a Corona material which you could use instead of "textmapDiffuse":

Code: [Select]
  .texmapDiffuse
  .texmapReflect
  .texmapReflectGlossiness
  .texmapRefract
  .texmapRefractGlossiness
  .texmapOpacity
  .texmapBump
  .texmapTranslucency
  .texmapReflectAnisotropy
  .texmapReflectAnisotropyRotation
  .texmapIor
  .texmapFresnelIor
  .texmapDisplace (texmapDisplacement)
  .texmapReflectBgOverride
  .texmapRefractBgOverride
  .texmapSelfIllum (texmapSelfIllumination)
  .texmapTranslucencyFraction
  .texmapAbsorption
  .texmapScatterColor
  .texmapSssAmount
  .texmapSssRadius
  .texmapSssScatterColor

Remember to evaluate scripts in the maxscript editor after changes (Ctrl+E).

BTW: Also see https://forum.corona-renderer.com/index.php?topic=19916.0

I get this error message

Which error do you get? I've been using it in Max2016+2018.


Good Luck




Title: Re: Show shaded material in viewport always on
Post by: Lucas Rodrigues on 2019-05-21, 13:39:33
I'm sorry, I forgot to share the error print. I talk about this mistake
https://i.imgur.com/uPaxGry.jpg
Title: Re: Show shaded material in viewport always on
Post by: Frood on 2019-05-21, 13:51:47
You should never get this when using it as startup script (it has been one). Manually running: Load into maxscript editor and press Ctrl-E.


Good Luck



Title: Re: Show shaded material in viewport always on
Post by: Lucas Rodrigues on 2019-05-21, 14:09:16
Wow, now this works great. I thank you with all my heart for all your willingness to help. Can I share this script with some friends?
Title: Re: Show shaded material in viewport always on
Post by: Frood on 2019-05-21, 14:40:23
Haha sure :) No magic inside.


Good Luck



Title: Re: Show shaded material in viewport always on
Post by: Lucas Rodrigues on 2019-05-21, 14:41:05
Thanks