zoukankan      html  css  js  c++  java
  • cocos2dx shader 变灰 及 冰冻效果

    变灰

    "                                           
    
    #ifdef GL_ES                                
    
    precision mediump float;                    
    
    #endif                                      
    
    
    
    uniform sampler2D u_texture;                
    
    varying vec2 v_texCoord;                    
    
    varying vec4 v_fragmentColor;               
    
    
    
    void main(void)                             
    
    {                                           
    
    // Convert to greyscale using NTSC weightings               
    
    vec4 col = texture2D(u_texture, v_texCoord);                
    
    float grey = dot(col.rgb, vec3(0.299, 0.587, 0.114));       
    
    gl_FragColor = vec4(grey, grey, grey, col.a);               
    
    }                                           
    
    ";
    

      冰冻

    "                                       
    
    #ifdef GL_ES				
    
    precision mediump float;		
    
    #endif					
    
    uniform sampler2D u_texture;		
    
    varying vec2 v_texCoord;		
    
    varying vec4 v_fragmentColor;		
    
    void main(void)				
    
    {					
    
    	vec4 normalColor = v_fragmentColor * texture2D(u_texture, v_texCoord);	
    
    	normalColor *= vec4(0.8, 0.8, 0.8, 1);	
    
    	normalColor.b += normalColor.a * 0.2;	
    
    	gl_FragColor = normalColor;	
    
    }                                       
    
    ";
    

      

    更多其他效果,参考http://blog.csdn.net/teng_ontheway/article/details/39190919

    Stay hungry, stay foolish!
  • 相关阅读:
    SpringBoot笔记
    SpringBoot面试篇
    多线程篇
    Tomcat篇
    Redis篇
    Nginx篇
    JVM篇
    MySQL篇
    python ETL工具 pyetl
    python通用数据库操作工具 pydbclib
  • 原文地址:https://www.cnblogs.com/JhonKing/p/5652456.html
Copyright © 2011-2022 走看看