Dec 2005
1 / 4
Dec 2005
Dec 2014

i was hoping that someone here could shed some light on how maya's openGl display operates. when i create and assign a blinn shader, for instance, what drives the feedback that i see in the viewport as i modify attributes of the shader? does the code used to create the maya software shader double as the openGl shader? if i were to create my own custom blinn shader using the maya api, will i get the same feedback? is this the same thing that drives the display when i switch to 'high quality rendering' or is this something else, based on the cgFx plugin?

the point of all this is that i am a mental ray shader writer, looking to get into api programming to help provide quality hardware feedback for the artists using my shaders. i'm hoping for some pointers or suggestions to give me some direction as i start out on this project.

thanks,
chad

  • created

    Dec '05
  • last reply

    Dec '14
  • 3

    replies

  • 2.3k

    views

  • 1

    user

  • 2

    links

QUOTE(Chadrik @ 12/06/05, 09:00 AM)
does the code used to create the maya software shader double as the openGl shader?
[snapback]221627[/snapback]

NO, you can notice that teh shaders dont avctualy match,, they are infact two separate pieces of code that originate form the same node. So yes that means you need to do double the work, as woudld you if you wnated tahse shame shader ffor maya. Each peiece of shader in maya is prettymucjh written 3 to 4 times (once for maya sw, once for mr, once for hardware and sometimes once for hiquality render)

Write a hardware shader that mimics the look of your mr code and link it to your shape. Its descriped in the api manual, under the topic Writing a Hardware Shading Node

you will prbably find it easiet to wirte a aseparate node thzt just makes the shader then connect iit to the shadingroup and monitor shader assignements with scriptjobs. TOugh making one compound node is doaoable in maya 7 by relating a maya shader to the mr one (see whats new in maya 7 section of the manual)

Tough if your lazy you cold ujust use the hardware shader maya uses and override what it is in mentalray, it works for most objects as something like sss or skin because they couldnt well be done in hw anyway. For exqample dgs nodes counld be represented by phong shader since its the closest feedback youd get. BEst part of this method is that you dont need to use the api for it as its allready implemented in maya.

QUOTE
if your lazy you cold ujust use the hardware shader maya uses and override what it is in mentalray
[snapback]221627[/snapback]

i AM lazy. my mr shader is not radically different from a blinn or a phong (it just allows splitting up into passes), so somehow overriding or piggybacking on maya's hardware shaders would be fine. i tried out the hwPhongShader in the api examples, but it doesn't support texture mapping or bump mapping, or much of anything really. how can i go about linking my mr shader with, say, the existing blinn hardware shader (the high quality one that does bump mapping and proper transparency, and all that jazz)? is this related to the cg shaders that are in /maya7.0/bin/Cg/ -- Maya_blinn_vertex.cg, Maya_blinn_fragment.cg, etc?

QUOTE
making one compound node is doaoable in maya 7 by relating a maya shader to the mr one
[snapback]221627[/snapback]

i looked into this -- in theory if i created a custom hardware shader i could link it with my mr shader, but will this custom maya shader work properly in hi-quality mode or will i need a cg shader? and if so, how do i link a cg shader to my mr shader....

i'm getting ahead of myself, tho. perhaps you can shed some more light on this for me before i begin formulating ridiculous hypotheses.

-chad

9 years later

Suggested Topics

Want to read more? Browse other topics in Maya or view latest topics.