Download presentation
Presentation is loading. Please wait.
Published byJordan Dickerson Modified over 9 years ago
1
Queensland University of Technology CRICOS No. 000213J INB382/INN382 Real-Time Rendering Techniques Lecture 13: Revision Ross Brown
2
CRICOS No. 000213J a university for the world real R Lecture Contents Exam Pointers Practice Exam
3
CRICOS No. 000213J a university for the world real R A Revision of History "Saint (n): A dead sinner revised and edited.” –Ambrose Bierce
4
CRICOS No. 000213J a university for the world real R Exam Information First question is memory fluff – short answer Middle questions are medium sized programming and analysis Final question is a non-trivial programming problem Do the previous exam questions I have uploaded onto Blackboard - one question is reused from a previous exam, we are covering some today Do the tutorial questions - one tutorial question is reused in the exam (can be theory or programming) Do the planet generation tutorial, please
5
CRICOS No. 000213J a university for the world real R Exam Information Allowed to take four pages of notes – no restrictions Emphasis is on Shaders – both Analysis and Programming Exam in the large is NOT on Unity, However, SHADERLAB is included – properties etc. Two hours, 50 marks – approximately two and half minutes per mark
6
CRICOS No. 000213J a university for the world real R Practice Exam Questions
7
QUESTION 1 What is the Penumbra? What sort of light source creates the Penumbra? (2 mark) What is the fundamental issue that causes Aliasing in computer graphics? (2 mark) What is a Fragment? Explain why it is different to a Pixel. (2 marks) Why is using a Normal Map more efficient than using a highly detailed polygonal object? (2 marks) Why can we not use White Noise as a primitive for procedural texturing of natural phenomena? (2 mark) (Total Marks for Question 1 = 10 marks)
8
QUESTION 1 The blurred boundary between the full umbra shadow, and a lit area. Caused by Area Light Sources. (2 marks) Aliasing is the induction of image artifacts that create unintended visual irregularities. Fundamentally, computers are discrete digital devices with limited precision in the representation of real values, thus the problem of aliasing is really a computational precision issue.(2 marks) A fragment is a potential pixel, before it is copied into the framebuffer. A fragment has other information attached, such as a z-value, stencil, alpha etc. A pixel is a pure RGB value in the framebuffer that appears as a colour.(2 marks) A normal map is a texture containing the normal value at that texture coordinate. It can be sent once and stored on the GPU. A polygonal mesh has to be sent across the bus to the GPU every time it is rendered. Since the bus is very slow, compared to texture accesses on the GPU card, it is costly.(2 marks) Each element is decorrelated from every other element. It is too full of high frequency noise. It is not repeatable. (Any two of these will do as full marks)(2 marks)
9
QUESTION 2 You are implementing the rendering algorithm for a children’s game, and you have to implement the vertex scale technique for generating a black silhouette around an object. Firstly, describe with a diagram how you can use the vertices in an object to generate a black outline.(2 marks) Secondly, program the following vertex shader with the vertex scale technique in order to create a black silhouette. Write down any assumptions you make void toonv(float4 positionIn : POSITION, float3 normalIn : NORMAL, out float4 positionOut: POSITION) { // Insert your code here } (4 marks) (Total Marks for Question 6 = 6 marks)
10
QUESTION 2 b) void toonv(float4 positionIn : POSITION, float3 normalIn : NORMAL, out float4 positionOut: SV_POSITION) { normalize(normalIn); (1 mark) float3 extrudedPos = positionIn + (normalIn * g_fEdgeFactor); (2 marks) positionOut = mul(UNITY_MATRIX_MVP, float4(extrudedPos, 1.0f)); (1 mark) return Output; } QUESTION 2 a)
11
QUESTION 3 void edgeDetectf(float2 texCoordIn : TEXCOORD0, sampler2D decal, float2 imgSize, out float4 Color : COLOR) { int i = 0; float4 c = 0.5;float2 texCoord;float2 offset;float4 texSamples[8]; float4 vertGradient;float4 horzGradient; /* Region lookup code deleted */ vertGradient = -(texSamples[0] + texSamples[5] + 2 * texSamples[3]); vertGradient += (texSamples[2] + texSamples[7] + 2 * texSamples[4]); horzGradient = -(texSamples[0] + texSamples[2] + 2 * texSamples[1]); horzGradient += (texSamples[5] + texSamples[7] + 2 * texSamples[6]); Color = sqrt( horzGradient * horzGradient + vertGradient * vertGradient ); } What do we mean by the shader concept Semantic, and how does it apply to TEXCOORD0? (1 mark) How do we calculate the offset, and why is it done this way? (2 marks) Insert the code to perform the region lookup for the edge detection algorithm. (4 marks)
12
Question 3 a) Links a variable to predefined variables in the hardware, providing and interface to default data flows (1/2 mark) TEXCOORD0 is the first set of texture coordinates used by the rasterisation system, passed from the geometry stage (1/2 mark) b) Offset is calculated by dividing 1.0 by the image dimensions in x an y (float2). This is so the program can target a particular texel in a reliable fashion. Texture sampling needs to be set to point. Often have to add offset/2.0 to the value to account for boundaries. (2 marks) c) (4 marks) offset = float2(1.0f, 1.0f) / imgSize; texCoord = a_Input.tex + float2(-offset.x, offset.y); texSamples[0] = tex2D(_MainTex, texCoord); // take sample texSamples[0] = dot(texSamples[0],.333333f); // convert to b&w // wash rinse and repeat for other six surrounding values. texCoord = a_Input.tex + float2(offset.x, -offset.y); texSamples[7] = tex2D(_MainTex, texCoord); // take sample texSamples[7] = dot(texSamples[7],.333333f); // convert to b&w
13
QUESTION 4 Using the following fragment shader header: void CircleFragment( float2 texCoord : TEXCOORD0, out float4 color : COLOR ) Create a pixel shader program using the above header, to create a circle on the surface of a polygon - the circle should be red, and the background of the polygon should be blue. It should look like the following in Figure 1 if the shader is run on a quad facing the viewer. Assume the centre of the circle is at texture coordinate (0, 0) on the quad. The texture coordinates at each corner vertex are arbitrary. Assume a radius of one for the circle.
14
QUESTION 4 void CircleFragment(float2 texCoord : TEXCOORD0, out float4 color : COLOR ) { float dist = sqrt(pow(0.0f - TexCoord.x, 2) + pow(0.0f - TexCoord.y, 2)); (2 marks for distance expression) float4 RED = {1.0, 0.0, 0.0, 1.0}; (1 mark for the two colors) float4 BLUE = {0.0, 0.0, 1.0, 1.0}; color = (dist == 1.0 ? RED : BLUE); (1 mark) }
15
Reframe!!!!
16
My Projects Need Minions! Contact me if you would like me to supervise you for Honours and other projects
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.