<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: C shader Viewport 2.0 texture display in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5977503#M13549</link>
    <description>&lt;P&gt;I had a feeling it was gonna come down to fragments. I tried doing a search&lt;BR /&gt;and again the help docs were limited on providing information.&lt;BR /&gt;&lt;BR /&gt;I was looking at &lt;A href="https://github.com/autodesk-adn/Maya-devkit/blob/master/osx/devkit/plug-ins/fileTexture/fileTexture.cpp" target="_self"&gt;this&lt;/A&gt;&amp;nbsp;for&amp;nbsp;reference . But I'm not too certain of what I should take and use. At line&lt;BR /&gt;305 is where all the fragments are created and added. Do I need to recreate&lt;BR /&gt;all these sections for my shader as well?&lt;BR /&gt;&lt;BR /&gt;I tried looking at the &lt;A href="http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__files_GUID_936878A1_2006_47CD_BC23_236E2F45E96E_htm/" target="_self"&gt;Xml schema&lt;/A&gt;&amp;nbsp;but&amp;nbsp;that doesn't explain much it just makes it more confusing because the third&lt;BR /&gt;section looks like what I need but it just says xml for fragment graph so&lt;BR /&gt;this just leaves me confused as to what it's called and what to look up.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ryan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Sent from Gmail Mobile&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2016 13:55:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-01-07T13:55:32Z</dc:date>
    <item>
      <title>C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5973111#M13545</link>
      <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm in the process of writing a shader but can't get the texture to display for VP2 or rather the parameter to set it to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;(as a side note everything else works as well as for VP1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the MShaderInstance im using the&amp;nbsp;&lt;STRONG&gt;k3dBlinnShader&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I havent found any list of parameters for the stock shaders.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the pixel data is acquired and set into a MTextureAssignment&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 02:28:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5973111#M13545</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-05T02:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5976870#M13546</link>
      <description>&lt;P&gt;Hi cronicryo,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do you try to get texture in VP2? Have you tried&amp;nbsp;&lt;SPAN&gt;MTextureManager::acquireTexture?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 02:48:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5976870#M13546</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2016-01-07T02:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5976944#M13547</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you for your response. I literally was about to give up today.&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;yes i have used acquire texture.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;i think the problem is that the data that im providing to the override is not what its looking for because my shader handles the color and it is not a direct link or something&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;first is how im getting the pixel data&lt;/DIV&gt;&lt;DIV&gt;this is just to be able to get a read of pixel data and would not be in the final implementation&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;and it does work in both the MTexture and MImage i have written both to disk and the data is there.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;MImage image;
MSelectionList selection;
selection.add("file1");
MObject obj;
selection.getDependNode(0, obj);

image.readFromTextureNode(obj);

image.resize(1024, 1024, false);
unsigned int width, height;
image.getSize(width, height);



MHWRender::MTextureDescription textureDesc;

textureDesc.setToDefault2DTexture();
textureDesc.fWidth = width;
textureDesc.fHeight = width;
textureDesc.fDepth = 1;
textureDesc.fBytesPerRow = 4*width;
textureDesc.fBytesPerSlice = 4*width*width;
textureDesc.fMipmaps = 1;
textureDesc.fArraySlices = 1;
textureDesc.fFormat = MHWRender::kR8G8B8A8_UNORM;
textureDesc.fTextureType = MHWRender::kImage2D;&lt;BR /&gt;&lt;BR /&gt;MString newTextureName = MString("MyCustomTexture");&lt;BR /&gt;mColorTexture.texture = textureManager-&amp;gt;acquireTexture(newTextureName, textureDesc, image.pixels());&lt;BR /&gt;//mColorTexture is a MTextureAssignment stored variable &lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so the first attempt i used&amp;nbsp;&lt;STRONG&gt;MPxShaderOverride&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;which i was able to get the a solid color and not a texture mapped to &lt;STRONG&gt;diffuseColor&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;once the texture was mapped the cube with the shader assigned was orangeif i didnt set the solid color&lt;/P&gt;&lt;P&gt;(im pretty sure the orange is the default color if nothing is changed)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then&amp;nbsp;the second&amp;nbsp;attempt i used &lt;STRONG&gt;MPxSurfaceShadingNodeOverride&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;which almost brought me closer i was able to get a texture to work by using the &lt;STRONG&gt;getCustomMappings&lt;/STRONG&gt; override and setting &lt;STRONG&gt;color&lt;/STRONG&gt; to &lt;STRONG&gt;outGlowColor&lt;/STRONG&gt; which if i mapped something it showed up but this wasnt the result i needed&amp;nbsp;&lt;/P&gt;&lt;P&gt;with this method i tried mapping &lt;STRONG&gt;color&lt;/STRONG&gt;&amp;nbsp;to &lt;STRONG&gt;outColor&lt;/STRONG&gt; and this worked too except not for the texture.&lt;/P&gt;&lt;P&gt;my shader layers colors together with blend modes and with this same method the color changed and to reiterate once a texture was connected it turned didnt show the texture.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;at this point my&amp;nbsp;consensus was that without a direct connection it wasnt working&lt;/P&gt;&lt;P&gt;so now still using the&amp;nbsp;&lt;STRONG&gt;MPxSurfaceShadingNodeOverride&amp;nbsp;&lt;/STRONG&gt;i tried with the mapping of&amp;nbsp;&lt;STRONG&gt;color&lt;/STRONG&gt;&lt;SPAN&gt; to &lt;/SPAN&gt;&lt;STRONG&gt;outGlowColor&amp;nbsp;&lt;/STRONG&gt;and in the hypershade connecting &lt;STRONG&gt;outColor &lt;/STRONG&gt;to&lt;STRONG&gt; outGlowColor&amp;nbsp;&lt;/STRONG&gt; i still did not get the texture to show.&lt;/P&gt;&lt;P&gt;so to make sure that the &lt;STRONG&gt;outColor&lt;/STRONG&gt;&amp;nbsp; was outputing properly i connected it into a &lt;STRONG&gt;layeredShader&lt;/STRONG&gt; and it display fine in the thumbnail.&lt;/P&gt;&lt;P&gt;i also then tried connecting that &lt;STRONG&gt;layeredShader&lt;/STRONG&gt; node into the &lt;STRONG&gt;outGlowColor&amp;nbsp;&lt;/STRONG&gt;and that still didnt work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;at this point im not sure what else to do or try.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the documentation on VP2 is at its minimum and its very hard to find a custom solution when the examples that are given are&amp;nbsp;ways to create a basic set up&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please Help! the studio im at uses an old old shader that was created and its been very useful except the there was no viewport set up and only worked in mental ray. i have implemented everything except VP2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Ryan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 04:56:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5976944#M13547</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-07T04:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5977071#M13548</link>
      <description>&lt;P&gt;Hi&amp;nbsp;cronicryo,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The acquireTexture code looks fine to me. MPxShaderOverrideNode::getCustomMappings() should be used for custom mapping parameter of&amp;nbsp;your shader fragment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, I think you are trying to use a k3dBlinnShader stock shader and want to add a texture as diffuseColor of it? In that case, you can use&lt;A href="http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__cpp_ref_class_m_h_w_render_1_1_m_shader_instance_html" target="_self"&gt;&lt;STRONG&gt; MShaderInstance::&lt;/STRONG&gt;&lt;/A&gt;&lt;SPAN&gt;&lt;A href="http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__cpp_ref_class_m_h_w_render_1_1_m_shader_instance_html" target="_self"&gt;&lt;STRONG&gt;addInputFragment&lt;/STRONG&gt;&lt;/A&gt; to apply a custom texture shader fragment as input for the diffuseColor of k3dBlinnShader stock shader.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have done that, the diffuseColor parameter can't be updated by &lt;STRONG&gt;MShaderInstance&lt;/STRONG&gt;&lt;STRONG&gt;::setParameter; &lt;/STRONG&gt;instead, you should update the parameter of your shader fragment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 07:47:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5977071#M13548</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2016-01-07T07:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: C shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5977503#M13549</link>
      <description>&lt;P&gt;I had a feeling it was gonna come down to fragments. I tried doing a search&lt;BR /&gt;and again the help docs were limited on providing information.&lt;BR /&gt;&lt;BR /&gt;I was looking at &lt;A href="https://github.com/autodesk-adn/Maya-devkit/blob/master/osx/devkit/plug-ins/fileTexture/fileTexture.cpp" target="_self"&gt;this&lt;/A&gt;&amp;nbsp;for&amp;nbsp;reference . But I'm not too certain of what I should take and use. At line&lt;BR /&gt;305 is where all the fragments are created and added. Do I need to recreate&lt;BR /&gt;all these sections for my shader as well?&lt;BR /&gt;&lt;BR /&gt;I tried looking at the &lt;A href="http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__files_GUID_936878A1_2006_47CD_BC23_236E2F45E96E_htm/" target="_self"&gt;Xml schema&lt;/A&gt;&amp;nbsp;but&amp;nbsp;that doesn't explain much it just makes it more confusing because the third&lt;BR /&gt;section looks like what I need but it just says xml for fragment graph so&lt;BR /&gt;this just leaves me confused as to what it's called and what to look up.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ryan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Sent from Gmail Mobile&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 13:55:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5977503#M13549</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-07T13:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5978980#M13550</link>
      <description>&lt;P&gt;Ok so i really hope you see this but im finally understanding what you mean by useing &lt;STRONG&gt;addInputFragement&lt;/STRONG&gt; so right now i have this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;mayaFileTexture&lt;/STRONG&gt; is a built in fragment that i tried using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;fColorShaderInstance&lt;/SPAN&gt;-&amp;gt;addInputFragment(&lt;SPAN&gt;"mayaFileTexture"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"outColor"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"diffuseColor" &lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;with furter investigaiton i spit out the xml of &lt;STRONG&gt;mayaFileTexture&amp;nbsp;&lt;/STRONG&gt;and the output name on the fragment is&amp;nbsp;&lt;STRONG&gt;mayaFileTextureOutput&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so i tried&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;fColorShaderInstance&lt;/SPAN&gt;-&amp;gt;addInputFragment(&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;mayaFileTexture&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"mayaFileTextureOutput"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"diffuseColor" &lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in both cases the MStatus returned:&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;(kUnknownParameter): Unexpected Internal Failure&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;im not sure what fragment i should be using or i should be creating my own and how&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 06:04:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5978980#M13550</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-08T06:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5978995#M13551</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was writing a reply while you are posting new one. I'll just reply to the latest one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "mayaFileTexture" should be your fragment graph name. The output of original fileTexture example&amp;nbsp;which uses a struct isn't fit for diffuseColor in blinn.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your usage, I think the output fragment&amp;nbsp;is no longer needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And for the shader part, the output should be float3, since diffuseColor is not a complex type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the fragment graph, the reference for output fragment is no longer needed and connection is not neither. The output should be a float3 type instead of struct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I think, the blinn attribute is not "diffuseColor", it should be "color".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. Due to the timezone(GMT+8) and recent events in APAC, I may not reply&amp;nbsp;in time. Sorry for the inconvinence.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 06:49:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5978995#M13551</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2016-01-08T06:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979000#M13552</link>
      <description>&lt;P&gt;No worries about the response time im just glad im getting some insight. So i sincerly thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;im a bit confused by your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;im not sure what you mean by "&lt;SPAN&gt;output fragment&amp;nbsp;is no longer needed."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;to me that means to do something like this&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;fColorShaderInstance&lt;/SPAN&gt;-&amp;gt;addInputFragment(&lt;SPAN&gt;"mayaFileTexture"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"diffuseColor"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i do understand what you mean by float3 and the struct not matching&lt;/P&gt;&lt;P&gt;so i tried this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;fColorShaderInstance&lt;/SPAN&gt;-&amp;gt;&lt;SPAN&gt;addInputFragment&lt;/SPAN&gt;(&lt;SPAN&gt;"mayaFileTexture"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"defaultColor"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"diffuseColor"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;both of these are still returning a result of&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;(kUnknownParameter): Unexpected Internal Failure&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;what are the&amp;nbsp;attributes that im supposed to be using?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 06:52:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979000#M13552</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-08T06:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979006#M13553</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I mean&lt;/P&gt;
&lt;PRE&gt;static const MString sFragmentOutputName("fileTexturePluginFragmentOutput");&lt;/PRE&gt;
&lt;P&gt;In original fileTexture is no longer needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the rest&amp;nbsp;fragments you can find&lt;/P&gt;
&lt;PRE&gt;&amp;lt;outputs&amp;gt;
	&amp;lt;struct name=\"output\" struct_name=\"fileTexturePluginFragmentOutput\" /&amp;gt;
&amp;lt;/outputs&amp;gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's the defination of fragment output. The original is a struct which contains float3 for RGB and float for alpha. The diffuseColor is float3, so the original struct is not suitable, you'll need to modify original shader and replace&amp;nbsp;the struct with float3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think diffuseColor is bilnn color attribute, so the addInputFragment should be something like&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;fColorShaderInstance&lt;/SPAN&gt;-&amp;gt;&lt;SPAN&gt;addInputFragment&lt;/SPAN&gt;(&lt;SPAN&gt;"mayaFileTexture"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"output"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"color"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 07:00:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979006#M13553</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2016-01-08T07:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979014#M13554</link>
      <description>&lt;P&gt;i see what happened i stoppped looking at the fileTextureNode example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;im using a fragment that already exists in the fragment manager called&amp;nbsp;maya FileTexture where the xml is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;fragment_graph  name="mayaFileTexture" ref="mayaFileTexture" class="FragmentGraph" version="1.0" feature_level="0" &amp;gt;
    &amp;lt;fragments&amp;gt;
            &amp;lt;fragment_ref name="mayaFileTextureOutput" ref="mayaFileTextureOutput" /&amp;gt;
            &amp;lt;fragment_ref name="mayaFileTextureColorEffects" ref="mayaFileTextureColorEffects" /&amp;gt;
            &amp;lt;fragment_ref name="mayaFileTextureBase" ref="mayaFileTextureBase" /&amp;gt;
            &amp;lt;fragment_ref name="mayafloat2PassThrough7" ref="mayafloat2PassThrough" /&amp;gt;
            &amp;lt;fragment_ref name="maya2dTextureUVOutOfBounds" ref="maya2dTextureUVOutOfBounds" /&amp;gt;
    &amp;lt;/fragments&amp;gt;
    &amp;lt;connections&amp;gt;
        &amp;lt;connect from="mayaFileTextureColorEffects.mayaFileTextureColorEffects" to="mayaFileTextureOutput.mayaFileTextureOutput" /&amp;gt;
        &amp;lt;connect from="mayaFileTextureBase.mayaFileTextureBase" to="mayaFileTextureColorEffects.effectsIn" /&amp;gt;
        &amp;lt;connect from="maya2dTextureUVOutOfBounds.maya2dTextureUVOutOfBounds" to="mayaFileTextureColorEffects.outOfBounds" /&amp;gt;
        &amp;lt;connect from="mayafloat2PassThrough7.mayafloat2PassThrough" to="mayaFileTextureBase.uvCoord" /&amp;gt;
        &amp;lt;connect from="maya2dTextureUVOutOfBounds.maya2dTextureUVOutOfBounds" to="mayaFileTextureBase.outOfBounds" /&amp;gt;
        &amp;lt;connect from="mayafloat2PassThrough7.mayafloat2PassThrough" to="maya2dTextureUVOutOfBounds.uvCoord" /&amp;gt;
    &amp;lt;/connections&amp;gt;
    &amp;lt;properties&amp;gt;
        &amp;lt;float2  name="uvCoord" ref="mayafloat2PassThrough7.input" semantic="mayaUvCoordSemantic" flags="varyingInputParam" /&amp;gt;
        &amp;lt;texture2  name="map" ref="mayaFileTextureBase.map" /&amp;gt;
        &amp;lt;sampler  name="textureSampler" ref="mayaFileTextureBase.textureSampler" /&amp;gt;
        &amp;lt;float3  name="defaultColor" ref="mayaFileTextureBase.defaultColor" /&amp;gt;
        &amp;lt;bool  name="hasAlpha" ref="mayaFileTextureBase.hasAlpha" /&amp;gt;
        &amp;lt;bool  name="invertV" ref="mayaFileTextureBase.invertV" /&amp;gt;
        &amp;lt;float2  name="UVScale" ref="mayaFileTextureBase.UVScale" /&amp;gt;
        &amp;lt;float2  name="UVOffset" ref="mayaFileTextureBase.UVOffset" /&amp;gt;
        &amp;lt;bool  name="invert" ref="mayaFileTextureColorEffects.invert" /&amp;gt;
        &amp;lt;bool  name="alphaIsLuminance" ref="mayaFileTextureColorEffects.alphaIsLuminance" /&amp;gt;
        &amp;lt;float  name="exposure" ref="mayaFileTextureColorEffects.exposure" /&amp;gt;
        &amp;lt;float3  name="colorGain" ref="mayaFileTextureColorEffects.colorGain" /&amp;gt;
        &amp;lt;float3  name="colorOffset" ref="mayaFileTextureColorEffects.colorOffset" /&amp;gt;
        &amp;lt;float  name="alphaGain" ref="mayaFileTextureColorEffects.alphaGain" /&amp;gt;
        &amp;lt;float  name="alphaOffset" ref="mayaFileTextureColorEffects.alphaOffset" /&amp;gt;
    &amp;lt;/properties&amp;gt;
    &amp;lt;values&amp;gt;
&amp;lt;float3 name="defaultColor" value="0.500000,0.500000,0.500000"  /&amp;gt;
&amp;lt;bool name="hasAlpha" value="false"  /&amp;gt;
&amp;lt;bool name="invertV" value="true"  /&amp;gt;
&amp;lt;float2 name="UVScale" value="1.000000,1.000000"  /&amp;gt;
&amp;lt;float2 name="UVOffset" value="0.000000,0.000000"  /&amp;gt;
&amp;lt;bool name="invert" value="false"  /&amp;gt;
&amp;lt;bool name="alphaIsLuminance" value="false"  /&amp;gt;
&amp;lt;float name="exposure" value="0.000000"  /&amp;gt;
&amp;lt;float3 name="colorGain" value="1.000000,1.000000,1.000000"  /&amp;gt;
&amp;lt;float3 name="colorOffset" value="0.000000,0.000000,0.000000"  /&amp;gt;
&amp;lt;float name="alphaGain" value="1.000000"  /&amp;gt;
&amp;lt;float name="alphaOffset" value="0.000000"  /&amp;gt;
    &amp;lt;/values&amp;gt;
    &amp;lt;outputs&amp;gt;
        &amp;lt;struct  name="mayaFileTextureOutput" ref="mayaFileTextureOutput.mayaFileTextureOutput" /&amp;gt;
    &amp;lt;/outputs&amp;gt;
&amp;lt;/fragment_graph&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so from lloking at this i would think i would do&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;fColorShaderInstance&lt;/SPAN&gt;-&amp;gt;addInputFragment(&lt;SPAN&gt;"mayaFileTexture"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;mayaFileTextureOutput&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"diffuseColor"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 07:06:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979014#M13554</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-08T07:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979046#M13555</link>
      <description>&lt;P&gt;oooohhhh ok ok ok&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i think i get it&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regardless of what i do i have to write my own custom fragment shader&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the &lt;STRONG&gt;fileTexture&lt;/STRONG&gt;&amp;nbsp;example&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;outputs&amp;gt;
	&amp;lt;struct name=\"output\" struct_name=\"fileTexturePluginFragmentOutput\" /&amp;gt;
&amp;lt;/outputs&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;this struct returns a rgb and an alpha (like you said)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;still reffering to the fileTexture example found&amp;nbsp;&lt;A href="https://github.com/autodesk-adn/Maya-devkit/blob/master/osx/devkit/plug-ins/fileTexture/fileTexture.cpp" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i would only be using the&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;fileTexturePluginFragment&amp;nbsp;&lt;/STRONG&gt;(i think)&lt;/P&gt;&lt;P&gt;i wouldnt be using the fragmentGraph because the connections dont need to be specified&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the&amp;nbsp;&lt;STRONG&gt;fileTexturePluginFragmentOutput&amp;nbsp;&lt;/STRONG&gt;defines the struct that i wouldnt be using because we need float3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the shader implementation would become this in the&amp;nbsp;&lt;STRONG&gt;fileTexturePluginFragment&lt;/STRONG&gt; implementations&lt;/P&gt;&lt;P&gt;that returns the float3 and only the float3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;outputs&amp;gt;&lt;BR /&gt; &amp;lt;float3 name=\"output\" /&amp;gt;"&lt;BR /&gt;&amp;lt;/outputs&amp;gt;&lt;/PRE&gt;&lt;P&gt;and the implimentation would become&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;float3 fileTexturePluginFragment(float2 uv, Texture2D map, sampler mapSampler)
 uv -= floor(uv);
 uv.y = 1.0f - uv.y;
 float4 color = map.Sample(mapSampler, uv); \
 return color.rgb;
} &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and after adding this fragment to the fragment manager&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i would do addInputFragment("&lt;SPAN&gt;fileTexturePluginFragment&lt;/SPAN&gt;", "output", "diffuseColor" )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please let me know if this is the right track.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 08:02:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979046#M13555</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-08T08:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979051#M13556</link>
      <description>&lt;P&gt;Hmm,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you'll still need to use fragmentGraph there instead of directly using the &lt;STRONG&gt;fileTexturePluginFragment &lt;/STRONG&gt;and the diffuseColor attribute of blinn should be "color".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other than that, I think you are on the right track:)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 08:11:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979051#M13556</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2016-01-08T08:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: C shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979056#M13557</link>
      <description>Ok i will attempt to implement this tomorrow. It's 3am by me&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Sent from Gmail Mobile</description>
      <pubDate>Fri, 08 Jan 2016 08:10:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5979056#M13557</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-08T08:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5980697#M13558</link>
      <description>&lt;P&gt;this is the fragment shader i created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i go into texture mode the geometry turns transparent&lt;/P&gt;&lt;P&gt;and nothing shows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the fragment gets added sucessfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please keep in my that im using a new shaderInstace of mayaSurfaceShaderSurface&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;applying like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;           fColorShaderInstance = shaderMgr-&amp;gt;getFragmentShader("mayaSurfaceShaderSurface","outColor" , true);

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my fragment file is as follows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;fragment uiName="fileTexturePluginFragment" name="fileTexturePluginFragment" type="plumbing" class="ShadeFragment" version="1.0"&amp;gt;
    &amp;lt;description&amp;gt;&amp;lt;![CDATA[Simple file texture fragment]]&amp;gt;&amp;lt;/description&amp;gt;
    &amp;lt;properties&amp;gt;
        &amp;lt;float2 name="uvCoord" semantic="mayaUvCoordSemantic" flags="varyingInputParam"/&amp;gt;
        &amp;lt;texture2 name="map"/&amp;gt;
        &amp;lt;sampler name="textureSampler"/&amp;gt;
    &amp;lt;/properties&amp;gt;
    &amp;lt;values&amp;gt;
    &amp;lt;/values&amp;gt;
    &amp;lt;outputs&amp;gt;
        &amp;lt;float3 name="output"/&amp;gt;
    &amp;lt;/outputs&amp;gt;
    &amp;lt;implementation&amp;gt;
        &amp;lt;implementation render="OGSRenderer" language="Cg" lang_version="2.100000"&amp;gt;
            &amp;lt;function_name val="fileTexturePluginFragment"/&amp;gt;
            &amp;lt;source&amp;gt;&amp;lt;![CDATA[
            float3 fileTexturePluginFragment(float2 uv, texture2D map, sampler2D mapSampler)
            {
                uv -= floor(uv);
                uv.y = 1.0f - uv.y;
                float4 color = tex2D(mapSampler, uv);
                return color.rgb;
            } ]]&amp;gt;
            &amp;lt;/source&amp;gt;
        &amp;lt;/implementation&amp;gt;
        &amp;lt;implementation render="OGSRenderer" language="HLSL" lang_version="11.000000"&amp;gt;
            &amp;lt;function_name val="fileTexturePluginFragment"/&amp;gt;
            &amp;lt;source&amp;gt;&amp;lt;![CDATA[
            float3 fileTexturePluginFragment(float2 uv, Texture2D map, sampler mapSampler)
            {
                uv -= floor(uv);
                uv.y = 1.0f - uv.y;
                float4 color = map.Sample(mapSampler, uv);
                return color.rgb;
            } ]]&amp;gt;
            &amp;lt;/source&amp;gt;
        &amp;lt;/implementation&amp;gt;

        &amp;lt;implementation render="OGSRenderer" language="GLSL" lang_version="3.0"&amp;gt;
            &amp;lt;function_name val="fileTexturePluginFragment"/&amp;gt;
            &amp;lt;source&amp;gt;&amp;lt;![CDATA[
            vec3 fileTexturePluginFragment(vec2 uv, sampler2D mapSampler)
            {
                uv -= floor(uv);
                uv.y = 1.0f - uv.y;
                vec4 color = texture(mapSampler, uv); \n
                return color.rgb;
            }]]&amp;gt;
            &amp;lt;/source&amp;gt;
        &amp;lt;/implementation&amp;gt;
    &amp;lt;/implementation&amp;gt;
&amp;lt;/fragment&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which gets assigned with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;CHECK_MSTATUS(fColorShaderInstance-&amp;gt;addInputFragment("fileTexturePluginFragment","output", "outColor"));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i use this to set the&amp;nbsp;parameters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;MHWRender::MSamplerStateDesc desc;
                        desc.filter = MHWRender::MSamplerState::kAnisotropic;
                        desc.maxAnisotropy = 16;
                        const MHWRender::MSamplerState *fSamplerState = MHWRender::MStateManager::acquireSamplerState(desc);

                        if (fSamplerState)
                        {
                            CHECK_MSTATUS(fColorShaderInstance-&amp;gt;setParameter("textureSampler", *fSamplerState));
                        }

//                        fColorShaderInstance-&amp;gt;setParameter("diffuse", &amp;amp;fDiffuse[0]);
                        CHECK_MSTATUS(fColorShaderInstance-&amp;gt;setParameter("map", mColorTexture));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 01:03:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5980697#M13558</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-09T01:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5980698#M13559</link>
      <description>&lt;P&gt;this is the fragment shader i created.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;when i go into texture mode the geometry turns transparent&lt;BR /&gt;and nothing shows&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;the fragment gets added sucessfully.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;please keep in my that im using a new shaderInstace of mayaSurfaceShaderSurface&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;applying like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;fColorShaderInstance = shaderMgr-&amp;gt;getFragmentShader("mayaSurfaceShaderSurface","outColor" , true);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my fragment file is as follows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;fragment uiName="fileTexturePluginFragment" name="fileTexturePluginFragment" type="plumbing" class="ShadeFragment" version="1.0"&amp;gt;
    &amp;lt;description&amp;gt;&amp;lt;![CDATA[Simple file texture fragment]]&amp;gt;&amp;lt;/description&amp;gt;
    &amp;lt;properties&amp;gt;
        &amp;lt;float2 name="uvCoord" semantic="mayaUvCoordSemantic" flags="varyingInputParam"/&amp;gt;
        &amp;lt;texture2 name="map"/&amp;gt;
        &amp;lt;sampler name="textureSampler"/&amp;gt;
    &amp;lt;/properties&amp;gt;
    &amp;lt;values&amp;gt;
    &amp;lt;/values&amp;gt;
    &amp;lt;outputs&amp;gt;
        &amp;lt;float3 name="output"/&amp;gt;
    &amp;lt;/outputs&amp;gt;
    &amp;lt;implementation&amp;gt;
        &amp;lt;implementation render="OGSRenderer" language="Cg" lang_version="2.100000"&amp;gt;
            &amp;lt;function_name val="fileTexturePluginFragment"/&amp;gt;
            &amp;lt;source&amp;gt;&amp;lt;![CDATA[
            float3 fileTexturePluginFragment(float2 uv, texture2D map, sampler2D mapSampler)
            {
                uv -= floor(uv);
                uv.y = 1.0f - uv.y;
                float4 color = tex2D(mapSampler, uv);
                return color.rgb;
            } ]]&amp;gt;
            &amp;lt;/source&amp;gt;
        &amp;lt;/implementation&amp;gt;
        &amp;lt;implementation render="OGSRenderer" language="HLSL" lang_version="11.000000"&amp;gt;
            &amp;lt;function_name val="fileTexturePluginFragment"/&amp;gt;
            &amp;lt;source&amp;gt;&amp;lt;![CDATA[
            float3 fileTexturePluginFragment(float2 uv, Texture2D map, sampler mapSampler)
            {
                uv -= floor(uv);
                uv.y = 1.0f - uv.y;
                float4 color = map.Sample(mapSampler, uv);
                return color.rgb;
            } ]]&amp;gt;
            &amp;lt;/source&amp;gt;
        &amp;lt;/implementation&amp;gt;

        &amp;lt;implementation render="OGSRenderer" language="GLSL" lang_version="3.0"&amp;gt;
            &amp;lt;function_name val="fileTexturePluginFragment"/&amp;gt;
            &amp;lt;source&amp;gt;&amp;lt;![CDATA[
            vec3 fileTexturePluginFragment(vec2 uv, sampler2D mapSampler)
            {
                uv -= floor(uv);
                uv.y = 1.0f - uv.y;
                vec4 color = texture(mapSampler, uv); \n
                return color.rgb;
            }]]&amp;gt;
            &amp;lt;/source&amp;gt;
        &amp;lt;/implementation&amp;gt;
    &amp;lt;/implementation&amp;gt;
&amp;lt;/fragment&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which gets assigned with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;CHECK_MSTATUS(fColorShaderInstance-&amp;gt;addInputFragment("fileTexturePluginFragment","output", "outColor"));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i use this to set the&amp;nbsp;parameters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;MHWRender::MSamplerStateDesc desc;
                        desc.filter = MHWRender::MSamplerState::kAnisotropic;
                        desc.maxAnisotropy = 16;
                        const MHWRender::MSamplerState *fSamplerState = MHWRender::MStateManager::acquireSamplerState(desc);

                        if (fSamplerState)
                        {
                            CHECK_MSTATUS(fColorShaderInstance-&amp;gt;setParameter("textureSampler", *fSamplerState));
                        }

//                        fColorShaderInstance-&amp;gt;setParameter("diffuse", &amp;amp;fDiffuse[0]);
                        CHECK_MSTATUS(fColorShaderInstance-&amp;gt;setParameter("map", mColorTexture));&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Jan 2016 01:05:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5980698#M13559</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-09T01:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5997034#M13560</link>
      <description>&lt;P&gt;Hi cronicryo,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for the late reply, and I think I made some mistakes earlier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to modify the vp2BlinnShader along with fileTexture in our devkit. It can use a texture from file now. There is still a&amp;nbsp;problem with swatch display, I'll simply remove it for now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To make vp2BlinnShader display a texture from a file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a shader fragment as I mentioned before, but the diffuseColor should be float4 instead of float3. And the diffuseColor property should be diffuseColor instead of color.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;void initializeFragmentShaders()
		{

			static const MString sFragmentName("fileTexturePluginFragment");
			static const char* sFragmentBody =
				"&amp;lt;fragment uiName=\"fileTexturePluginFragment\" name=\"fileTexturePluginFragment\" type=\"plumbing\" class=\"ShadeFragment\" version=\"1.0\"&amp;gt;"
				"	&amp;lt;description&amp;gt;&amp;lt;![CDATA[Simple file texture fragment]]&amp;gt;&amp;lt;/description&amp;gt;"
				"	&amp;lt;properties&amp;gt;"
				"		&amp;lt;float2 name=\"uvCoord\" semantic=\"mayaUvCoordSemantic\" flags=\"varyingInputParam\" /&amp;gt;"
				"		&amp;lt;texture2 name=\"map\" /&amp;gt;"
				"		&amp;lt;sampler name=\"textureSampler\" /&amp;gt;"
				"	&amp;lt;/properties&amp;gt;"
				"	&amp;lt;values&amp;gt;"
				"	&amp;lt;/values&amp;gt;"
				"	&amp;lt;outputs&amp;gt;"
				"		&amp;lt;float4 name=\"output\" /&amp;gt;"
				"	&amp;lt;/outputs&amp;gt;"
				"	&amp;lt;implementation&amp;gt;"
				"	&amp;lt;implementation render=\"OGSRenderer\" language=\"Cg\" lang_version=\"2.100000\"&amp;gt;"
				"		&amp;lt;function_name val=\"fileTexturePluginFragment\" /&amp;gt;"
				"		&amp;lt;source&amp;gt;&amp;lt;![CDATA["
				"float4 fileTexturePluginFragment(float2 uv, texture2D map, sampler2D mapSampler) \n"
				"{ \n"
				"	uv -= floor(uv); \n"
				"	uv.y = 1.0f - uv.y; \n"
				"	float4 color = tex2D(mapSampler, uv); \n"
				"	return color.rgba; \n"
				"} \n]]&amp;gt;"
				"		&amp;lt;/source&amp;gt;"
				"	&amp;lt;/implementation&amp;gt;"
				"	&amp;lt;implementation render=\"OGSRenderer\" language=\"HLSL\" lang_version=\"11.000000\"&amp;gt;"
				"		&amp;lt;function_name val=\"fileTexturePluginFragment\" /&amp;gt;"
				"		&amp;lt;source&amp;gt;&amp;lt;![CDATA["
				"float4 fileTexturePluginFragment(float2 uv, Texture2D map, sampler mapSampler) \n"
				"{ \n"
				"	uv -= floor(uv); \n"
				"	uv.y = 1.0f - uv.y; \n"
				"	float4 color = map.Sample(mapSampler, uv); \n"
				"	return color.rgba; \n"
				"} \n]]&amp;gt;"
				"		&amp;lt;/source&amp;gt;"
				"	&amp;lt;/implementation&amp;gt;"
				"	&amp;lt;implementation render=\"OGSRenderer\" language=\"GLSL\" lang_version=\"3.0\"&amp;gt;"
				"		&amp;lt;function_name val=\"fileTexturePluginFragment\" /&amp;gt;"
				"		&amp;lt;source&amp;gt;&amp;lt;![CDATA["
				"float4 fileTexturePluginFragment(vec2 uv, sampler2D mapSampler) \n"
				"{ \n"
				"	uv -= floor(uv); \n"
				"	uv.y = 1.0f - uv.y; \n"
				"	vec4 color = texture(mapSampler, uv); \n"
				"	return color.rgba; \n"
				"} \n]]&amp;gt;"
				"		&amp;lt;/source&amp;gt;"
				"	&amp;lt;/implementation&amp;gt;"
				"	&amp;lt;/implementation&amp;gt;"
				"&amp;lt;/fragment&amp;gt;";
			// Register fragments with the manager if needed
			//
			MHWRender::MRenderer* theRenderer = MHWRender::MRenderer::theRenderer();
			if (theRenderer)
			{
				MHWRender::MFragmentManager* fragmentMgr =
					theRenderer-&amp;gt;getFragmentManager();
				if (fragmentMgr)
				{
					// Add fragments if needed
					bool fragAdded = fragmentMgr-&amp;gt;hasFragment(sFragmentName);					
					if (!fragAdded)
					{
						fragAdded = (sFragmentName == fragmentMgr-&amp;gt;addShadeFragmentFromBuffer(sFragmentBody, false));
					}				
					if (fragAdded)
					{
						fFragmentName = sFragmentName;
						TRACE_API_CALLS("Added Fragment");
					}
				}
			}
		}&lt;BR /&gt;&lt;BR /&gt;void createCustomMappings()&lt;BR /&gt; {&lt;BR /&gt; // Set up some mappings for the parameters on the file texture fragment,&lt;BR /&gt; // there is no correspondence to attributes on the node for the texture&lt;BR /&gt; // parameters.&lt;BR /&gt; MHWRender::MAttributeParameterMapping mapMapping(&lt;BR /&gt; "map", "", false, true);&lt;BR /&gt; mappings.append(mapMapping);&lt;BR /&gt;&lt;BR /&gt; MHWRender::MAttributeParameterMapping textureSamplerMapping(&lt;BR /&gt; "textureSampler", "", false, true);&lt;BR /&gt; mappings.append(textureSamplerMapping);&lt;BR /&gt; }
&lt;/PRE&gt;
&lt;P&gt;And I called them&amp;nbsp;in the createShaderInstance&lt;/P&gt;
&lt;PRE&gt;void createShaderInstance()
	{
		TRACE_API_CALLS("vp2BlinnShaderOverride::createShaderInstance");
		MHWRender::MRenderer *renderer = MHWRender::MRenderer::theRenderer();
		const MHWRender::MShaderManager* shaderMgr = renderer ? renderer-&amp;gt;getShaderManager() : NULL;
		if (!shaderMgr)
			return;

		initializeFragmentShaders();		
		createCustomMappings();

		if (!fColorShaderInstance)
		{
			fColorShaderInstance = shaderMgr-&amp;gt;getStockShader( MHWRender::MShaderManager::k3dBlinnShader );			
			fColorShaderInstance-&amp;gt;addInputFragment(fFragmentName, MString("output"), MString("diffuseColor"));
		}
		if (!fNonTexturedColorShaderInstance)
		{
			fNonTexturedColorShaderInstance = shaderMgr-&amp;gt;getStockShader( MHWRender::MShaderManager::k3dBlinnShader );
			if (fNonTexturedColorShaderInstance)
			{
				fNonTexturedColorShaderInstance-&amp;gt;setParameter("diffuseColor", &amp;amp;fNonTextured[0]);
			}
		}
	}&lt;/PRE&gt;
&lt;P&gt;Then, I modified updateShaderInstance,&lt;/P&gt;
&lt;PRE&gt;	void updateShaderInstance()
	{
		TRACE_API_CALLS("vp2BlinnShaderOverride::updateShaderInstance");
		if (fColorShaderInstance)
		{
			// Update shader to mark it as drawing with transparency or not.
			fColorShaderInstance-&amp;gt;setIsTransparent( isTransparent() );

			//Replace diffuse update with fragment parameters update
			//fColorShaderInstance-&amp;gt;setParameter("diffuseColor", &amp;amp;fDiffuse[0] );
			updateShader();
			fColorShaderInstance-&amp;gt;setParameter("specularColor", &amp;amp;fSpecular[0] );
		}
		if (fNonTexturedColorShaderInstance)
		{
			fNonTexturedColorShaderInstance-&amp;gt;setParameter("diffuseColor", &amp;amp;fNonTextured[0]);
		}
	}

void updateShader()
		{
			TRACE_API_CALLS("Update texture");
			MHWRender::MRenderer *renderer = MHWRender::MRenderer::theRenderer();
			
			fFragmentTextureShader = fColorShaderInstance;
			if(!fFragmentTextureShader)
			{
				TRACE_API_CALLS("Can't get fragment texture");
				return;
			}
			// A random png file on my disk
			MString fFileName("D:\\screenshot.png");

			if (fResolvedMapName.length() == 0)
			{

				const MHWRender::MAttributeParameterMapping* mapping =
					mappings.findByParameterName("map");
				if (mapping)
				{
					TRACE_API_CALLS("Resolved mapping parameter");

					fResolvedMapName = mapping-&amp;gt;resolvedParameterName();
				}
			}
			if (fResolvedSamplerName.length() == 0)
			{
				const MHWRender::MAttributeParameterMapping* mapping =
					mappings.findByParameterName("textureSampler");
				if (mapping)
				{
					TRACE_API_CALLS("Resolved texture sampler");
					fResolvedSamplerName = mapping-&amp;gt;resolvedParameterName();
				}
			}

			// Set the parameters on the shader
			if (fResolvedMapName.length() &amp;gt; 0 &amp;amp;&amp;amp; fResolvedSamplerName.length() &amp;gt; 0)
			{
				// Set sampler to linear-wrap
				if (!fSamplerState)
				{
					MHWRender::MSamplerStateDesc desc;
					desc.filter = MHWRender::MSamplerState::kAnisotropic;
					desc.maxAnisotropy = 16;
					fSamplerState = MHWRender::MStateManager::acquireSamplerState(desc);
				}
				if (fSamplerState)
				{
					TRACE_API_CALLS("Update sampler parameter");
					fFragmentTextureShader-&amp;gt;setParameter(fResolvedSamplerName, *fSamplerState);
				}

				// Set texture
				MHWRender::MRenderer* renderer = MHWRender::MRenderer::theRenderer();
				if (renderer)
				{
					MHWRender::MTextureManager* textureManager =
						renderer-&amp;gt;getTextureManager();
					if (textureManager)
					{
						MHWRender::MTexture* texture =
							textureManager-&amp;gt;acquireTexture(fFileName);
						if (texture)
						{
							MHWRender::MTextureAssignment textureAssignment;
							textureAssignment.texture = texture;
							TRACE_API_CALLS("Update texture parameter");

							fFragmentTextureShader-&amp;gt;setParameter(fResolvedMapName, textureAssignment);

							// release our reference now that it is set on the shader
							textureManager-&amp;gt;releaseTexture(texture);
						}
					}
				}
			}
		}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At last, we need to add geometry texture to the shader since we can't update UV directly. Add following codes in the initialize&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                MHWRender::MVertexBufferDescriptor textureDesc(
			empty, // Better to have a name here
			MHWRender::MGeometry::kTexture,
			MHWRender::MGeometry::kFloat,
			2);
		addGeometryRequirement(textureDesc);&lt;/PRE&gt;
&lt;P&gt;It should be working now.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 09:21:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5997034#M13560</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2016-01-20T09:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5997595#M13561</link>
      <description>&lt;P&gt;i did get this to work in your absensce i was missing the&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; MHWRender::MVertexBufferDescriptor textureDesc(
			empty, // Better to have a name here
			MHWRender::MGeometry::kTexture,
			MHWRender::MGeometry::kFloat,
			2);
		addGeometryRequirement(textureDesc);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which took me a bit to figure out the next thing i ran into was getting the diffuse color to show up because the texture was connected to diffuseColor it wasnt showin up so i had to had more parameters to make a switch for the returned value&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;so my fragment function looks like this generally&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            &amp;lt;source&amp;gt;&amp;lt;![CDATA[
            float3 fileTexturePluginFragment(float3 myColor, bool useTexture, float2 uv, texture2D map, sampler2D mapSampler)
            {
                if(useTexture){
                    float4 color = tex2D(mapSampler, uv);
                    return color.rgb;
                }else{
                    return myColor;
                }

            } ]]&amp;gt;
            &amp;lt;/source&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2016 15:24:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/5997595#M13561</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-20T15:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/6431117#M13562</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to do almost the same thing, except I try to achieve this with a&amp;nbsp;MPxSubSceneOverride and not a&amp;nbsp;MPxSurfaceShadingNodeOverride.&lt;/P&gt;&lt;P&gt;The main problem is that the&amp;nbsp;&lt;SPAN&gt;MPxSubSceneOverride doesn't have a&amp;nbsp;getCustomMappings function and I cannot reach the&amp;nbsp;MHWRender::MAttributeParameterMappingList so I cannot map the sampler's and the map's attributes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there any way to do this kind of fragment connection between a surface shader and a file texture shader in a&amp;nbsp;MPxSubSceneOverride?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ferenc&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 12:11:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/6431117#M13562</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-12T12:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/6435314#M13563</link>
      <description>&lt;P&gt;Hi ferenc,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use MShaderInstance::parameterList and MShaderInstance::&lt;SPAN&gt;parameterType to get shader's parameter.&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sampler should be named as smap for Maya default's shader(k3dSolidTexture).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Li&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 05:19:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/6435314#M13563</guid>
      <dc:creator>cheng_xi_li</dc:creator>
      <dc:date>2016-07-14T05:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: C++ shader Viewport 2.0 texture display</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/6435490#M13564</link>
      <description>&lt;P&gt;Hi Li,&lt;/P&gt;&lt;P&gt;Unfortunately something wrong here. I am posting the relevant code here, can you check it? I used&amp;nbsp;&lt;SPAN&gt;MShaderInstance::parameterList to get the parameters, so I created a sampler just like ina shader node, but nothing is drawn in the viewport.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I use only a solidShader and I set it's color, it works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if (!fShadedShader)
{
	if (!fSamplerState)
	{
		MHWRender::MSamplerStateDesc desc;
		desc.filter = MHWRender::MSamplerState::kAnisotropic;
		desc.maxAnisotropy = 16;
		fSamplerState = MHWRender::MStateManager::acquireSamplerState(desc, &amp;amp;status);
	}
	
	fShadedShader = shaderMgr-&amp;gt;getStockShader(MHWRender::MShaderManager::k3dSolidTextureShader);
	if (fSamplerState)
	{
		fShadedShader-&amp;gt;setParameter("samp", *fSamplerState);
	}
	MHWRender::MTextureManager* textureManager =
		renderer-&amp;gt;getTextureManager();
	if (textureManager)
	{
		MString fFileName;
		MRenderUtil::exactFileTextureName("C:/image.hdr", false, "", fFileName);
		MHWRender::MTexture* texture =
			textureManager-&amp;gt;acquireTexture(fFileName);
		if (texture)
		{
			MHWRender::MTextureAssignment textureAssignment;
			textureAssignment.texture = texture;
			fShadedShader-&amp;gt;setParameter("map", textureAssignment);
			textureManager-&amp;gt;releaseTexture(texture);
		}
	}
}&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ferenc&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 08:22:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/c-shader-viewport-2-0-texture-display/m-p/6435490#M13564</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-14T08:22:25Z</dc:date>
    </item>
  </channel>
</rss>

