Holistic3D https://holistic3d.com Teaching All Things Game Development Sat, 28 Mar 2020 23:27:32 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.2 TPR https://holistic3d.com/tpr/ Thu, 20 Feb 2020 00:04:57 +0000 https://holistic3d.com/?p=7033

What an Amazing Instructor

What an amazing instructor, I’ve purchased many of her series. The quality and relevancy of topics can apply to any developer at any skill level. There’s something for everyone.

DOTS Survey https://holistic3d.com/dots-survey/ Mon, 10 Feb 2020 06:22:29 +0000 https://holistic3d.com/?p=7000
This survey is no longer available.
Understanding UVGrab Value Calculations for Glass Shaders https://holistic3d.com/understanding-uvgrab-value-calculations-for-glass-shaders/ Wed, 05 Feb 2020 06:57:41 +0000 https://holistic3d.com/?p=6978

The job of a glass shader is to make the object appear transparent, though sometimes you might want to distort the image that appears on it.  This means it’s not simply a matter of making something transparent but getting the scene behind the glass onto the glass plane (or whatever glass object you have).  That requires us to take a screen grab and place the pixels of that screen grab on the plane.



This image represents the first step in getting a grab of the pixels on the screen behind the glass and putting them onto the surface of the glass.  So each pixel of the entire scene (minus the glass) is basically put into the exact same UV position on the plane.  You can see the effect this has had. The larger screen grab of the entire window is placed onto the plane and thus results in the screen appearing smaller.  It looks like the scene has been scaled right down or that the objects in the scene have become further away.  Why?

o.vertex is in world space whereas o.uvgrab is in the screen space. For the vertex the z value stores the depth information and the w stores the forth value in a homogeneous vector.  When w is 1 the vector is normalised (e.g. has a length of 1) if w is any other value then it is the scale of the vector. 


If you set the uvgrab.zw to o.vertex.zw you’ll get a better looking screen grab on the plane but it will be offset due to the grab and vertex zw values being used for different reasons.

Why is this? Well the clip space isn’t the final value that gets used the clip space is then converted to normalised device coordinates (NDC) which are found by dividing each of the (x, y, z, 1) values in clip space with w to get them into a NDC (x/w, y/w, z/w, 1).

The NDC z value is a depth coordinate but goes from 0 on the near plane to 1 on the far plane with Direct3D, Metal and gaming consoles and in OpenGL the value rates from -1 on the near plane to +1 on the far plane.


By adding o.vertex.w to the x and y vertex values you are essentially moving value in the uvgrab over by the scaled value if there is one.  This essentially moves the entire grab over by at the most 1 UV which is the entire image width and height.


So then multiplying the resulting x and y by 0.5 will move them across by half re-centering the pixels on the glass plane.

In all, what you’ve achieved is correctly positioning the UVs for a screen grab of the pixels directly behind the plane, onto the plane using the plane’s depth in the scene thanks to the z and w values.  But you’ve had to make adjustments to the x and y values because when you go from clip to NDC everything gets scaled again automatically in the background for you.

A New H3D Website https://holistic3d.com/a-new-h3d-website/ Sun, 27 Oct 2019 12:13:15 +0000 https://holistic3d.com/?p=6463 ]]> Hello world! https://holistic3d.com/hello-world/ https://holistic3d.com/hello-world/#comments Sat, 28 Sep 2019 04:12:53 +0000 https:/?p=1 Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

https://holistic3d.com/hello-world/feed/ 1
Just An Image https://holistic3d.com/just-an-image/ Thu, 31 Jan 2013 01:52:58 +0000 https://themify.me/demo/themes/metro/?p=452

Sed sagittis, elit egestas rutrum vehicula, neque dolor fringilla lacus, ut rhoncus turpis augue vitae libero. Nam risus velit, rhoncus eget consectetur id, posuere at ligula. Vivamus imperdiet diam ac tortor tempus posuere. Curabitur at arcu id turpis posuere bibendum. Sed commodo mauris eget diam pretium cursus. In sagittis feugiat mauris, in ultrices mauris lacinia eu. Fusce augue velit, vulputate elementum semper congue, by Themify.

Audio post https://holistic3d.com/audio-post/ Thu, 24 Jan 2013 23:55:18 +0000 https://themify.me/demo/themes/metro/?p=127

Lorem ipsum dolor sit amet, consectetur adipiscing elit.https://themify.me/demo/themes/wumblr/files/2010/12/katy2.mp3

Confucius quote https://holistic3d.com/confucius-quote/ Thu, 24 Jan 2013 23:52:02 +0000 https://themify.me/demo/themes/metro/?p=124 "It does not matter how slowly you go as long as you do not stop." Confucius -

Studio Photography https://holistic3d.com/studio-photography/ Thu, 24 Jan 2013 23:47:58 +0000 https://themify.me/demo/themes/metro/?p=120

Pellentesque vitae purus eros, ut dapibus sem. Fusce in ipsum at augue cursus consectetur. Curabitur lacinia, lorem eget gravida volutpat, magna nunc dapibus purus, et fringilla ipsum ante in eros.

Status update https://holistic3d.com/status-update/ Thu, 24 Jan 2013 23:45:47 +0000 https://themify.me/demo/themes/metro/?p=118 Duis dui risus, scelerisque in elementum in, consequat sed ipsum.