cg

Why are dFdx/ddx and dFdy/ddy 2 dimension variables when quering a 2d texture?

こ雲淡風輕ζ 提交于 2019-12-04 13:15:46
问题 I cannot seem to understand this, shouldn't the derivative/change along the U or V coordinate in a 2d texture/array be single dimension variable as we are checking it only along ddx (U coordinate) or ddy (V coordinate)? 回答1: There are 4 distinct partial derivatives here: du/dx, dv/dx, du/dy, and dv/dy. None of those four values need be zero, unless the texture image coordinates happen to be perfectly aligned to the display screen axes. In general the texture coordinate axes need not be

Why are dFdx/ddx and dFdy/ddy 2 dimension variables when quering a 2d texture?

谁说胖子不能爱 提交于 2019-12-03 08:41:37
I cannot seem to understand this, shouldn't the derivative/change along the U or V coordinate in a 2d texture/array be single dimension variable as we are checking it only along ddx (U coordinate) or ddy (V coordinate)? There are 4 distinct partial derivatives here: du/dx, dv/dx, du/dy, and dv/dy. None of those four values need be zero, unless the texture image coordinates happen to be perfectly aligned to the display screen axes. In general the texture coordinate axes need not be aligned to the screen display axes. X and Y (display viewport axes) are not the same directions as U and V

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

Vertex shader vs Fragment Shader [duplicate]

梦想与她 提交于 2019-11-28 15:14:24
This question already has an answer here: What are Vertex and Pixel shaders? 5 answers I've read some tutorials regarding Cg, yet one thing is not quite clear to me. What exactly is the difference between vertex and fragment shaders? And for what situations is one better suited than the other? The Surrican A fragment shader is the same as pixel shader. One main difference is that a vertex shader can manipulate the attributes of vertices. which are the corner points of your polygons. The fragment shader on the other hand takes care of how the pixels between the vertices look. They are

CoreGraphics for retina display

旧时模样 提交于 2019-11-28 03:50:05
I am using the following code to perform some manipulations on the image that I loaded, but I find that the display becomes blurry when it is on the retina display - (UIImage*)createImageSection:(UIImage*)image section:(CGRect)section { float originalWidth = image.size.width ; float originalHeight = image.size.height ; int w = originalWidth * section.size.width; int h = originalHeight * section.size.height; CGContextRef ctx = CGBitmapContextCreate(nil, w, h, 8, w * 8,CGImageGetColorSpace([image CGImage]), kCGImageAlphaPremultipliedLast); CGContextClearRect(ctx, CGRectMake(0, 0, originalWidth *

Vertex shader vs Fragment Shader [duplicate]

别等时光非礼了梦想. 提交于 2019-11-27 09:04:14
问题 This question already has an answer here: What are Vertex and Pixel shaders? 5 answers I've read some tutorials regarding Cg, yet one thing is not quite clear to me. What exactly is the difference between vertex and fragment shaders? And for what situations is one better suited than the other? 回答1: A fragment shader is the same as pixel shader. One main difference is that a vertex shader can manipulate the attributes of vertices. which are the corner points of your polygons. The fragment

CoreGraphics for retina display

不问归期 提交于 2019-11-27 05:13:04
问题 I am using the following code to perform some manipulations on the image that I loaded, but I find that the display becomes blurry when it is on the retina display - (UIImage*)createImageSection:(UIImage*)image section:(CGRect)section { float originalWidth = image.size.width ; float originalHeight = image.size.height ; int w = originalWidth * section.size.width; int h = originalHeight * section.size.height; CGContextRef ctx = CGBitmapContextCreate(nil, w, h, 8, w * 8,CGImageGetColorSpace(