### 1 Minute VEX

537   2   1
Member
3 posts
Joined: Feb. 2018
Offline
Hello everyone!

Every Monday at 12am for the last 3 weeks I have been uploading VEX snippets as mini-tutorials on my website: https://aaronsmith.tv/1-Minute-VEX [aaronsmith.tv]

Here, through ‘1 Minute VEX’, I'll try to walk you through some of the more obscure and advanced functions that exist, and add as much explanation as possible to accompany the images in text based form. Be warned, these are not for Houdini beginners!

Below is 1 Minute VEX III as an example; Let me know if anyone has any suggestions for improvement.

-

1 Minute VEX - Ray-Cast Ambient Occlusion

In this example, we begin by creating a variable for position - offsetting it from the surface very slightly to avoid unintended ray intersections.

Once we have assigned how many samples we want, and the hemispherical radius of our ambient occlusion (which determines how close geometry has to be to occlude), we use a for loop to iterate over each sample.

We then generate a random hemispherical direction using our point normal, and use that directional vector as the ray. If our ray hits geometry, its distance from initial position is fit within a 1-0 range - 1 being the closest a ray could possibly be, and 0 being the furthest.

This value is added and accumulated through the ‘ao’ variable, and then divided by the total number of samples added to the variable. We finally return the complement, in order to make close intersections dark, and distant rays / non intersections bright.

Edited by aaronsmithtv - Sept. 11, 2020 19:49:40

Attachments:
1mvt_003_thumb.png (148.1 KB)

Member
3 posts
Joined: Feb. 2018
Offline
Hello everyone!

I'd like to thank you all for the interest the last time around, so I thought i'd celebrate by releasing the next 3 minutes of VEX; Exploring all things camera.

If you missed it the first time, every Monday at 12pm for the last month-ish I have been posting VEX mini-tutorial snippets on my website, the most recent of which can be found below. Enjoy!

1 Minute VEX IV - https://aaronsmith.tv/1-Minute-VEX-IV-V [aaronsmith.tv]

An introduction to NDC space, and using to/fromNDC() to scale objects without changing position relative to camera.

1 Minute VEX V - https://aaronsmith.tv/1-Minute-VEX-IV-V#1mv_v [aaronsmith.tv]

Using toNDC() and removepoint() to delete points that are not displayed on camera.

1 Minute VEX VI - https://aaronsmith.tv/1-Minute-VEX-VI [aaronsmith.tv]

Using intersect() and optransform() to delete points hidden by camera occluding geometry.
Member
3 posts
Joined: Feb. 2018
Offline
Hello once again!

Since the last time I posted here I've added three new tutorials, all of which briefly cover textures, mapping and colour in VEX. Thanks to everyone once again for all of the support and useful suggestions!

1 Minute VEX VII - OCIO transformed attribute from image - https://aaronsmith.tv/1-Minute-VEX-VII [aaronsmith.tv]

Using colormap() and ocio_transform() to read an sRGB image and convert it to an ACES-compliant attribute.

1 Minute VEX VIII - sampling nearest texture with UDIM filename expansion - https://aaronsmith.tv/1-Minute-VEX-VIII [aaronsmith.tv]

Using xyzdist(), primuv() and colormap() to sample the nearest UDIM-friendly texture on a surface.

1 Minute VEX IX - triplanar mapping & projection - https://aaronsmith.tv/1-Minute-VEX-IX [aaronsmith.tv]

Using simple vector math, for loops and colormap() to create a triplanar projection.

Please feel free to PM me with any questions or suggestions.