shader

How to get full list of Unity shader properties

蹲街弑〆低调 提交于 2019-12-01 00:47:55
问题 I am quite new to shaders and have been searching for a full list of Unity shader properties. I haven't found any such documentation. What I found was SL-Properties. Where can I find a full list of properties and their functions? UPDATE An example was given in SL-Properties showing the list of properties for a water shader namely, _WaveScale , _Fresnel , _BumpMap and so on. Knowing these specific properties make it easier to arrive at a solution. I recently tried coding something similar to a

Convert RGBA to YUV by OpenGL ES shader

别说谁变了你拦得住时间么 提交于 2019-11-30 23:40:16
最近在做android平台摄像头采集和视频渲染,当想要把性能做到极致的时候,总避不开使用GPU。在视频采集、美颜以及其他前处理之后,需要将数据转换成I420格式,方便后续处理,如果使用CPU去做会导致性能瓶颈。因为我们在前处理过程都是采用GPU去做,因此这个转换使用GPU去做不仅方便,而且能充分利用GPU的优势。 1. 输入输出数据格式 在编写OpenGL ES的shader前,先需要确定好fragment shader的输入和输出格式。输入可以是一个包含RGBA的texture,或者是分别包含Y、U、V的三个texture,也可以使包含Y和UV的两个texture(UV分别放在texture rgba的r和a中,NV21和NV12都可以用这种方式)。输出的texture不仅要包含所有的YUV信息,还要方便我们一次性读取I420格式数据(glReadPixels)。因此输出数据的YUV紧凑地分布: +---------+ | | | Y | | | | | +----+----+ | U | V | | | | +----+----+ 而对于OpenGL ES来说,目前它输入只认RGBA、lumiance、luminace alpha这几个格式,输出大多数实现只认RGBA格式,因此输出的数据格式虽然是I420格式,但是在存储是我们仍然要按照RGBA方式去访问texture数据。

Pointers on modern OpenGL shadow cubemapping?

无人久伴 提交于 2019-11-30 21:51:17
问题 Background I am working on a 3D game using C++ and modern OpenGL (3.3). I am now working on the lighting and shadow rendering, and I've successfully implemented directional shadow mapping. After reading over the requirements for the game I have decided that I'd be needing point light shadow mapping. After doing some research, I discovered that to do omnidirectional shadow mapping I will do something similar to directional shadow mapping, but with a cubemap instead. I have no previous

FXC : error X3501: 'main': entrypoint not found

若如初见. 提交于 2019-11-30 19:25:59
I am following an example book called: Introduction to 3D Game Programming with DirectX 11 It is all written in VS2010. I would like to try using VS2013... It is an example project for Windows Desktop Program I have a program with the following in it (including some other files as part of common use): color.fx //*************************************************************************************** // color.fx by Frank Luna (C) 2011 All Rights Reserved. // // Transforms and colors geometry. //*************************************************************************************** cbuffer

unity shader 波动圈

笑着哭i 提交于 2019-11-30 19:13:10
c# //////////////////////////////////////////// // CameraFilterPack - by VETASOFT 2018 ///// //////////////////////////////////////////// using UnityEngine; using System.Collections; [ExecuteInEditMode] [AddComponentMenu ("Camera Filter Pack/Distortion/ShockWave Manual")] public class CameraFilterPack_Distortion_ShockWaveManual : MonoBehaviour { #region Variables public Shader SCShader; private float TimeX = 1.0f; private Material SCMaterial; [Range(-1.5f, 1.5f)] public float PosX = 0.5f; [Range(-1.5f, 1.5f)] public float PosY = 0.5f; [Range(-0.1f, 2f)] public float Value = 0.5f; [Range(0f,

【Unity Shader】---数据类型和关键字

吃可爱长大的小学妹 提交于 2019-11-30 18:03:34
推荐: https://www.cnblogs.com/nanwei/p/7277417.html 上面链接作者的整个系列都写的不错 https://www.cnblogs.com/nanwei/category/1025420.html 【Unity Shader】---数据类型和关键字 一、基本数据类型: Cg支持7种基本的数据类型 1、float,32位浮点数据,一个符号位。浮点数据类型被所有的图形接口支持; 2、half,16位浮点数据; 3、int,32位整形数据 4,fixed,12位定点数, 5、bool,布尔数据,被所有的图形接口支持; 6、sampler*,纹理对象的句柄,分为sampler、sampler1D、sampler2D、sampler3D、samplerCUBE和samplerRECT。 二、内置的数据类型 基于基础数据类型,如float3,表示float类型的三维向量;同理,bool2表示布尔类型的二维向量。 注:向量最长不能超过四元,如float5 vector;//编译错误 向量的赋值:     float2 a=float(1.0,1.0); //编译通过 float2 a=float(1.0f,1.0f); //编译错误 float3 b=float(a,0.0); //编译通过 矩阵数据类型:     float1X1 m1; /

Compile each .metal file into a separate .metallib

浪子不回头ぞ 提交于 2019-11-30 17:46:23
问题 I would like to override the default Xcode Metal compiler behaviour of compiling all project .metal files into a single default.metallib and instead compile each .metal file into a separate .metallib file. However I cannot see how to approach this; can anyone provide a lead? Xcode version: 10.1 回答1: I achieved this in two steps: 1) Add a custom build rule for .metal files that compiles them individually into .metallib s: 2) Add a custom build step for copying those .metallib s into your

How to make a wave warp effect in shader?

五迷三道 提交于 2019-11-30 15:13:43
问题 I want to make a wave warp effect like this: But I can only create the normal sine wave. Here is my fragment shader: precision mediump float; varying vec2 v_texCoord; uniform sampler2D s_baseMap; vec2 SineWave( vec2 p ){ float pi = 3.14159; float A = 0.15; float w = 10.0 * pi; float t = 30.0*pi/180.0; float y = sin( w*p.x + t) * A; return vec2(p.x, p.y+y);  } void main(){ vec2 p = v_texCoord; vec2 uv = SineWave( p ); vec4 tcolor = texture2D(s_baseMap, uv); gl_FragColor = tcolor; } and result

billboarding vertices in the vertex shader

笑着哭i 提交于 2019-11-30 15:07:11
Code demonstrating issue (comment/uncomment out the gl_Position lines in the vertex shader) var scene; var book; var shaderMaterial; var renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setClearColor(0x000000); document.body.appendChild(renderer.domElement); var camera = new THREE.PerspectiveCamera(55, 1, 0.1, 40000); window.onresize = function () { renderer.setSize(window.innerWidth, window.innerHeight); camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); }; window.onresize(); scene = new THREE.Scene(); camera.position.z = 25; camera

OpenGL ES Shaders and 64-bit iPhone 5S

早过忘川 提交于 2019-11-30 13:50:20
I just started testing with the iPhone 5S and the 64bit architecture on an OpenGL ES app. The problem I'm seeing is that (CGFloat) values are way wrong when they get to the shaders. I pass in 0.8 and it changes to -1.58819e-23 when I debug the shader. I am using glUniform4fv() to pass in the value. Do I need to use a different data type or? or a different method to pass in the values? The value goes through fine when I test on 32bit CGFloat brushColor[4]; brushColor[0] = 0.8; brushColor[1] = 0.1; brushColor[2] = 0.1; brushColor[3] = 0.3; glUniform4fv(program[PROGRAM_POINT].uniform[UNIFORM