Highlighted

Generating Normal/Bump Maps Programmatically/Through External Scripting

Community Beginner ,
Sep 25, 2020

Copy link to clipboard

Copied

I am currently in the process of automating some parts of a pipeline in which generating normal/bump maps programmatically is one part.

 

I am currently doing this through a Maya Python plugin. The Python plugin currently automates other programs such as Maya, Handbrake and Photoshop. 

 

Inside Photoshop, the current method of generation involves playing through an action which generates these maps that was recorded before hand. The downside of using this technique is that you are unable to modify the settings of the generation.

 

I would like to be able to generate a series of normal/bump maps with Photoshop programatically such that all of the settings visible below are availible to the users of the python plugin:

Screenshot 2020-09-25 130012.pngScreenshot 2020-09-25 130052.png

 

What I have looked into:

  • ExtendScript - Unable to find the relevant method.
  • COM - Unable to find the relevant method.
  • Actions - Unable to modify with granularity. 
    • Modification can be done via having multiple .atn files which each have a different configuration, however this does not allow for fine control of slider values.

As a sidenote about .atn files/Actions, I have seen this response indicating that at one point in time it was possible to edit Actions as text files outside of photoshop, but at current time it seems this is unavailible.

 

 

Correct answer by Cory5E06 | Community Beginner

So I did figure out a solution to my problem, though its certainly not very future proof. I just wanted to leave it here in case someone else happens to want to do this same specific thing.

 

Heres what I did:

 

  1. Download and install the ScriptingListenerplugin  official plugin from adobe
  2. Set up an example of a file to use the desired action on.
  3. Delete the JS log placed on the desktop by the Scripting Listner Plugin
  4. Complete the action manually with identifiable values (like 1 for the first option, 2 for the second etc, just so we can identify what is what later for anything that isnt obvious)
  5. Look at the JS log to the last completd action which looks to match what you want to happen. In my case it was not super obvious so the identifiable values from earlier are helpful. You may find that some values dont actually matter and can be completely cut out (some I assume are actually for ui)
  6. Note all of the relevant variables that need to be modified and passed in
  7. Create a script which replaces all hard coded values of the relevant script excerpt with variables read in from a JSON file in a temp folder. (This public domain JSON library will help you in parsing JSON through extendscript)
  8. In your plugin, create whatever interface you need to collect values for the necessary variables that need to be passed in.
  9. Write those out to a JSON file in the same format as your script
  10. Set your plugin to run the script when needed. You will now be able to pass in parameters on the fly... in a very convoluted bodged together manner.
TOPICS
Actions and scripting, How to, Windows

Views

55

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Generating Normal/Bump Maps Programmatically/Through External Scripting

Community Beginner ,
Sep 25, 2020

Copy link to clipboard

Copied

I am currently in the process of automating some parts of a pipeline in which generating normal/bump maps programmatically is one part.

 

I am currently doing this through a Maya Python plugin. The Python plugin currently automates other programs such as Maya, Handbrake and Photoshop. 

 

Inside Photoshop, the current method of generation involves playing through an action which generates these maps that was recorded before hand. The downside of using this technique is that you are unable to modify the settings of the generation.

 

I would like to be able to generate a series of normal/bump maps with Photoshop programatically such that all of the settings visible below are availible to the users of the python plugin:

Screenshot 2020-09-25 130012.pngScreenshot 2020-09-25 130052.png

 

What I have looked into:

  • ExtendScript - Unable to find the relevant method.
  • COM - Unable to find the relevant method.
  • Actions - Unable to modify with granularity. 
    • Modification can be done via having multiple .atn files which each have a different configuration, however this does not allow for fine control of slider values.

As a sidenote about .atn files/Actions, I have seen this response indicating that at one point in time it was possible to edit Actions as text files outside of photoshop, but at current time it seems this is unavailible.

 

 

Correct answer by Cory5E06 | Community Beginner

So I did figure out a solution to my problem, though its certainly not very future proof. I just wanted to leave it here in case someone else happens to want to do this same specific thing.

 

Heres what I did:

 

  1. Download and install the ScriptingListenerplugin  official plugin from adobe
  2. Set up an example of a file to use the desired action on.
  3. Delete the JS log placed on the desktop by the Scripting Listner Plugin
  4. Complete the action manually with identifiable values (like 1 for the first option, 2 for the second etc, just so we can identify what is what later for anything that isnt obvious)
  5. Look at the JS log to the last completd action which looks to match what you want to happen. In my case it was not super obvious so the identifiable values from earlier are helpful. You may find that some values dont actually matter and can be completely cut out (some I assume are actually for ui)
  6. Note all of the relevant variables that need to be modified and passed in
  7. Create a script which replaces all hard coded values of the relevant script excerpt with variables read in from a JSON file in a temp folder. (This public domain JSON library will help you in parsing JSON through extendscript)
  8. In your plugin, create whatever interface you need to collect values for the necessary variables that need to be passed in.
  9. Write those out to a JSON file in the same format as your script
  10. Set your plugin to run the script when needed. You will now be able to pass in parameters on the fly... in a very convoluted bodged together manner.
TOPICS
Actions and scripting, How to, Windows

Views

56

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 25, 2020 0
Community Beginner ,
Sep 28, 2020

Copy link to clipboard

Copied

I would also benefit from simply knowing how to parse actions

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 0
Community Beginner ,
Oct 14, 2020

Copy link to clipboard

Copied

So I did figure out a solution to my problem, though its certainly not very future proof. I just wanted to leave it here in case someone else happens to want to do this same specific thing.

 

Heres what I did:

 

  1. Download and install the ScriptingListenerplugin  official plugin from adobe
  2. Set up an example of a file to use the desired action on.
  3. Delete the JS log placed on the desktop by the Scripting Listner Plugin
  4. Complete the action manually with identifiable values (like 1 for the first option, 2 for the second etc, just so we can identify what is what later for anything that isnt obvious)
  5. Look at the JS log to the last completd action which looks to match what you want to happen. In my case it was not super obvious so the identifiable values from earlier are helpful. You may find that some values dont actually matter and can be completely cut out (some I assume are actually for ui)
  6. Note all of the relevant variables that need to be modified and passed in
  7. Create a script which replaces all hard coded values of the relevant script excerpt with variables read in from a JSON file in a temp folder. (This public domain JSON library will help you in parsing JSON through extendscript)
  8. In your plugin, create whatever interface you need to collect values for the necessary variables that need to be passed in.
  9. Write those out to a JSON file in the same format as your script
  10. Set your plugin to run the script when needed. You will now be able to pass in parameters on the fly... in a very convoluted bodged together manner.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 14, 2020 0