{"id":3706,"date":"2022-05-09T19:31:56","date_gmt":"2022-05-09T10:31:56","guid":{"rendered":"https:\/\/blog.criware.com\/?p=3706"},"modified":"2024-05-21T10:09:24","modified_gmt":"2024-05-21T01:09:24","slug":"random-3d-positioning","status":"publish","type":"post","link":"https:\/\/blog.criware.com\/index.php\/2022\/05\/09\/random-3d-positioning\/","title":{"rendered":"Random 3D Positioning"},"content":{"rendered":"<p>Creating believable soundscapes in games often requires a large number of 3D sound sources. These sound sources can use complex attenuation and\/or angle curves to make an ambience sound as natural as possible. To add even more realism and liveliness to a scene, it is also possible to randomize the 3D positions of the sounds, which will be demonstrated in this blog.<\/p>\n<div style=\"width: 800px; display: block;margin: 40px auto;\" class=\"wp-video\">\n<div style=\"width: 800px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3706-1\" width=\"800\" height=\"450\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Video-01-Random-3D-Positioning.mp4?_=1\" \/><a href=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Video-01-Random-3D-Positioning.mp4\">https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Video-01-Random-3D-Positioning.mp4<\/a><\/video><\/div>\n<\/div>\n<h2 style=\"font-size: 150%; font-weight: bold; margin-top: 40px;\">Pan Randomization<\/h2>\n<p>For sounds that do not need accurate positioning or distance attenuation and can stay in 2D, randomizing the panoramic position is the simplest option:<\/p>\n<ul>\n<li>Select a Cue and, in the Inspector, ensure that the <em>Pan Type<\/em> property is set to <em>Pan [5.1]<\/em><\/li>\n<li>Then, in the Pan [5.1] section, simply increase the <em>Pan3D Angle Random<\/em> property from 1 to 360\u00b0<\/li>\n<li>From now on, each time the Cue is played it will be randomly positioned around the listener<\/li>\n<li>If needed, attenuation can be simulated by randomizing the Volume of the Cue<\/li>\n<\/ul>\n<p style=\"text-align:center;\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-01Pan-random-properties.png\" alt=\"Screenshot 01Pan random properties\" width=\"621\" height=\"369\" class=\"alignnone size-full wp-image-3710\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-01Pan-random-properties.png 621w, https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-01Pan-random-properties-300x178.png 300w\" sizes=\"auto, (max-width: 621px) 100vw, 621px\" \/>\n<\/p>\n<h2 style=\"font-size: 150%; font-weight: bold; margin-top: 40px;\">3D Position Randomization<\/h2>\n<p>Randomizing the 3D position can be very useful for sources that are spread in a distinct area while not being clearly localized e.g., birds in a forest, insects in a field, vegetation rustle due to the wind, isolated screams in a crowd etc..<\/p>\n<p>When using position randomization on a 3D Cue, the Min and Max attenuation distances, as well as the attenuation angle, will be taken into account. Playback positions will be distributed inside a shape centered on the original sound source position, which will be used to determine the attenuation.<\/p>\n<p style=\"text-align:center;\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-02-3DPOS_RandomPosition.png\" alt=\"Screenshot 02 3DPOS_RandomPosition\" width=\"640\" height=\"360\" class=\"alignnone size-full wp-image-3711\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-02-3DPOS_RandomPosition.png 640w, https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-02-3DPOS_RandomPosition-300x169.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/>\n<\/p>\n<p>To activate random 3D positioning:<\/p>\n<ul>\n<li>Select a Cue and navigate to the Inspector\u2019s 3D Positioning section<\/li>\n<li>Set the <em>Min and Max Distance of 3D Positioning Attenuation<\/em> properties<\/li>\n<li>Select a shape under the <em>Random Sound Source Shape<\/em> property (see below for more details)<\/li>\n<li>Based on that shape, set the extent of the randomization (see properties such as <em>[Rectangle] Random width<\/em> or <em>[Sphere] Random radius\u2026<\/em>)<\/li>\n<\/ul>\n<p style=\"text-align:center;\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-03-3d-shape-properties.png\" alt=\"Screenshot 03 3d shape properties\" width=\"642\" height=\"453\" class=\"alignnone size-full wp-image-3712\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-03-3d-shape-properties.png 642w, https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-03-3d-shape-properties-300x212.png 300w\" sizes=\"auto, (max-width: 642px) 100vw, 642px\" \/>\n<\/p>\n<p>Available shapes for random positioning are: None (no randomization), Rectangle, Cuboid, Circle, Cylinder, Sphere, Free, and List.<\/p>\n<p>For Rectangles, Cuboids, and Cylinders, the random widths (left to right, front to back, and top to bottom) are centered on the shape. For example, if a 10-meter width is specified for the <em>[Rectangle] Random width &#8211; Left and Right<\/em>, the position will be randomized in the range of -5 to +5 meters. For Circles, Cylinders, and Spheres, the random radius is based on the center of the shape as well.<\/p>\n<p>The Free and List shapes are aimed to be used programmatically. The Free shape makes it possible for a programmer to specify a custom randomization function via a callback mechanism (CRIATOMEX3DSOURCE_RANDOM_POSITION_CALCULATION_TYPE_CALLBACK). In the case of the List shape, the position will be randomly selected from a list of coordinates provided by the programmer.<\/p>\n<p style=\"text-align:center;\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-04-pos3d_random_types.png\" alt=\"Screenshot 04 pos3d_random_types\" width=\"745\" height=\"359\" class=\"alignnone size-full wp-image-3713\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-04-pos3d_random_types.png 745w, https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/Screenshot-04-pos3d_random_types-300x145.png 300w\" sizes=\"auto, (max-width: 745px) 100vw, 745px\" \/>\n<\/p>\n<p>For a realistic effect, a shape smaller than the area in which the 3D sound source is located should be used. Selecting the right shape will also improve the realism of the implementation. For instance, a spherical shape will work well for birds in trees, while a cuboid will be more appropriate for a crowd in a stadium stand.<\/p>\n<p>Check our demo project and try it for yourself!<\/p>\n<div style=\"max-width: 800px; margin: 0 auto; margin-bottom: 20px; text-align: center;\"><a style=\"display: block; border: 1px solid #ccc; padding: 20px; max-width: 100%; margin: 0 auto;\" href=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2022\/05\/AtomCraft_Project_Random_3DPositioning.zip\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1813\" style=\"display: block; margin: 0 auto;\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2018\/06\/zip.png\" alt=\"zip\" width=\"80\" height=\"78\">AtomCraft_Project_Random_3DPositioning.zip<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Creating believable soundscapes in games often requires a large number of 3D sound sources. These sound sources can use complex<\/p>\n","protected":false},"author":2,"featured_media":5493,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-3706","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-adx","category-tutorials"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/3706","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/comments?post=3706"}],"version-history":[{"count":6,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/3706\/revisions"}],"predecessor-version":[{"id":3721,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/3706\/revisions\/3721"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/media\/5493"}],"wp:attachment":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/media?parent=3706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/categories?post=3706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/tags?post=3706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}