• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Lieene-Guo · Dec 04, 2014 at 01:52 PM · shaderlab

Tessellation shader custom vertex modifer output?

Hello I'm currently working on a tessellation+Alloy PBR shader and I found that the custom vertex output trick used in Alloy vertex shader is not supported in tessellation vertex modifier. here's my vertex modifier

         void SrVert(inout appdata_sr v, out Input o)
         {
             float4 uv = float4(v.texcoord.xy,0,0);
             float d = tex2Dlod(_SR_BaseHgtCur,uv).r * _SR_DetalHeightMax;
             v.vertex.xyz += v.normal * d;
             UNITY_INITIALIZE_OUTPUT(Input, o);
             o.texcoords.xy = v.texcoord;            
         #if defined(_UV1AO2_ON)
             o.texcoords.zw = v.texcoord1;
         #endif 
         }

But in unity generated shader file custom vertex output is not supported

 [UNITY_domain("tri")]
 v2f_SrSurf ds_SrSurf (UnityTessellationFactors tessFactors, const OutputPatch<InternalTessInterp_appdata_sr,3> vi, float3 bary : SV_DomainLocation) {
   appdata_sr v;
   v.vertex = vi[0].vertex*bary.x + vi[1].vertex*bary.y + vi[2].vertex*bary.z;
   float3 pp[3];
   for (int i = 0; i < 3; ++i)
     pp[i] = v.vertex.xyz - vi[i].normal * (dot(v.vertex.xyz, vi[i].normal) - dot(vi[i].vertex.xyz, vi[i].normal));
   v.vertex.xyz = _SR_tessPhong * (pp[0]*bary.x + pp[1]*bary.y + pp[2]*bary.z) + (1.0f-_SR_tessPhong) * v.vertex.xyz;
   v.tangent = vi[0].tangent*bary.x + vi[1].tangent*bary.y + vi[2].tangent*bary.z;
   v.normal = vi[0].normal*bary.x + vi[1].normal*bary.y + vi[2].normal*bary.z;
   v.texcoord = vi[0].texcoord*bary.x + vi[1].texcoord*bary.y + vi[2].texcoord*bary.z;
   v.texcoord1 = vi[0].texcoord1*bary.x + vi[1].texcoord1*bary.y + vi[2].texcoord1*bary.z;
   SrVert (v);
   v2f_SrSurf o = vert_SrSurf (v);
   return o;
 }

as unity shader-lab generated code cannot call this vertex modifier function with to parameter. Does any one know any work around?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image guijiamin · Jun 19, 2016 at 05:33 AM 0
Share

The same question with you.

But do you have found any answer now?

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to turn off sorting of transparent objects? 1 Answer

Blending 3 textures using a shader 1 Answer

optimising shaderlab code and using properties variable 1 Answer

SurfaceOutput.viewDir not the same in deferred 1 Answer

Strange ShaderLab Syntax Error 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges