|By Mike Jacobs||
|March 9, 2005 12:00 AM EST||
Reach behind your television and yank the cable out of the wall. Do you hear that noise? Not the kids screaming about their movie. Look at the screen. What you see is white noise: random bits of white, black and gray changing constantly. What does this have to do with movie magic or Java3D? What if a spell could conjure roaring fires, fluffy clouds, rippling water, naturally grained wood, smooth marble and even realistic terrains? That spell is available to us thanks to the inventive mind of Dr. Ken Perlin.
Who Was That Math Man?
Ken Perlin is a professor in the department of computer science at New York University. In 1997 he won an Academy Award for Technical Achievement from the Academy of Motion Picture Arts and Sciences for his procedural texturing techniques, which are widely used in feature films and television. He also had a big part in the computer animation in the movie "TRON." The techniques pioneered by Dr. Perlin allow programs to generate a wide range of realistic special effects efficiently. The foundation for these effects is a mathematical function called Perlin noise.
What Was That Noise?
Procedural texturing is the art of using an algorithm to generate a texture. Procedural techniques are not limited to texturing and can be applied to geometry, motion, color or any other thing you can imagine. Procedural techniques abstract the details of a scene or sequence into an algorithm. Parameters on the algorithm allow a variety of results to be achieved with the same algorithm. An example of procedural geometry was in my last article ("When Mars Is Too Big to Download," JDJ, September 2004) where we used parameters to vary the detail and roughness of the generated terrain. The advantage of using procedural techniques is that the details are generated, saving the cost of explicitly storing and retrieving them.
To make realistic special effects, we need a way to generate natural looking randomness. You might think that random numbers would be sufficient to accomplish this, but you would only be partially right. (See Figure 1.) Random numbers are typically generated without regard to past values. This lack of correlation can lead to abrupt changes between adjacent values and an unnatural special effect. What we need is a repeatable, smooth, non-cyclic random function whose results vary with the parameters we provide. Perlin noise was designed to do just that.
While the implementation details of Perlin noise are beyond the scope of this article, we do need a conceptual model to use it. The noise function accepts a number of double parameters and returns a double value between +1 and -1. One-dimensional noise is the result of generating random numbers at regular intervals and smoothly interpolating noise values in between using a high-order polynomial. This can be represented by a smooth curve as shown in Figure 1.
Two-dimensional noise does the interpolation in two dimensions forming a wavy noise surface. The three-dimensional noise can't be depicted graphically, but its foundation is a lattice. The three parameters represent the three dimensions of the lattice from which the noise value is calculated. This lattice consists of 256 by 256 by 256 points representing random numbers between which values are smoothly interpolated to calculate the noise. The noise value at the integer lattice locations is zero, while the values between the locations follows the same high-order polynomial mentioned above. A Java reference implementation called ImprovedNoise is available from Dr. Perlin's home page and a modified version is included with the source code for this article.
This probably sounds pretty mysterious, so let's put this magic to work with a few examples.
Casting Our First Spell: Blur
In my last article, we generated terrains with colors assigned based solely on elevation. Looking closely at some of the resulting terrains, you may have noticed that the colors created a layered effect. For this article, the FractalWorld3 example uses your choice of random numbers or Perlin noise to blur the colors to eliminate the layered affect. Have a look at Figure 2 to see this example in action.
In this example, the noise function is used to blur the boundaries between colors to make the transitions less apparent. The effect is implemented by nudging the color index with the noise function as shown in part in Listing 1.
The color index is determined normally and then a delta value is calculated with the noise function. The sum of the index and the delta value is rounded and clamped to create the new color index. This method uses the row, column and elevation as arguments to the noise function. All three are scaled down to focus the noise based on trial and error. You can think of the divisors as a zoom function into the noise. Because the noise is defined in a limited-size lattice, the zoom factor focuses the range: higher zoom results in less noise range. Finding the right recipe for an effect is mostly an art but luckily others have shared their recipes.
Texturing with Noise
A popular use for noise is to generate the colors on a texture. We can apply the texture to a shape, giving the appearance of natural materials like wood or marble. Have a look at Figure 3 for an example of an image produced by the PerlinNoiseSphere.
Java3D supports texturing of a shape by setting the texture image on the appearance object. The PerlinNoiseSphere example uses a Java3D Sphere primitive as the shape and Perlin noise to generate the texture. The Sphere primitive is used in this example so some texturing details can be automatically done for us. Setting up the texture on the appearance is shown in part in Listing 2. The getImage() method is where the magic happens. The recipe is used to determine the noise values and the PerlinNoiseSphere example interprets the values as colors. Before I disclose the secret to this trick, I should mention that there's no relationship between how the recipe creates the texture and how nature creates the material. These recipes have been arrived at through trial and error and bit of luck. The results look amazingly close to the real thing, which teaches us that: In 3D graphics, there's nothing like a great fake.
The recipe for the wood texture in Listing 3 is decidedly simple.
The grain value is determined by the noise method using the image row and column as parameters. The color for the image pixel is based on the red, green and blue values calculated with the grain. Creating static texture images with noise is interesting, but the power of noise is even greater when combined with animation.
A Java3D behavior links keyboard, mouse or temporal events with changes to the scene or view. For example, the keyboard or mouse can be used to update the view allowing us to move the virtual camera through the scene. Java3D includes this support with the KeyNavigatorBehavior, MouseRotate, MouseTranslate and MouseZoom behaviors. Time can be used to animate the movement or morph the shape attributes in our scene and Java3D includes subclasses of Interpolator for this as well. While there are a number of behaviors available in Java3D, it's likely you'll eventually need to create your own behavior and Java3D is designed for that.
When a behavior is created, the constructor typically defines the triggering or wake-up condition such as a keyboard or mouse event, a number of frames or the passage of time. Behaviors are added to the scene like any other Java3D object.
When your scene is initially rendered, Java3D calls the initialize() method where your implementation should set the trigger. When Java3D detects the triggering event, it calls the processStimulus() method on your behavior. Your implementation of this method does its thing and then must reset the trigger. The documentation for the Behavior class is excellent, so refer to it for more details.
The ElapsedTimeBehavior example is the basis for the animation examples in this article. When triggered, this behavior calls the tick() method on the configured listener after the specified number of milliseconds has passed. Milliseconds are used as the trigger rather than the number of frames so it runs consistently across different computers. Let's use this behavior to recreate the animation of a movie special effect in Java3D.
|Charles W. Neville 04/01/05 06:13:34 PM EST|
|Mike Jacobs 03/09/05 08:28:35 PM EST|
Stop by at http://mnjacobs.javadevelopersjournal.com/ to help influence future Java3D articles and see what's in the works for next time (assuming JDJ will have me).
Early adopters of IoT viewed it mainly as a different term for machine-to-machine connectivity or M2M. This is understandable since a prerequisite for any IoT solution is the ability to collect and aggregate device data, which is most often presented in a dashboard. The problem is that viewing data in a dashboard requires a human to interpret the results and take manual action, which doesn’t scale to the needs of IoT.
Jul. 25, 2016 01:00 PM EDT Reads: 1,919
SYS-CON Events announced today that 910Telecom will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Housed in the classic Denver Gas & Electric Building, 910 15th St., 910Telecom is a carrier-neutral telecom hotel located in the heart of Denver. Adjacent to CenturyLink, AT&T, and Denver Main, 910Telecom offers connectivity to all major carriers, Internet service providers, Internet backbones and ...
Jul. 25, 2016 12:15 PM EDT Reads: 396
CenturyLink has announced that application server solutions from GENBAND are now available as part of CenturyLink’s Networx contracts. The General Services Administration (GSA)’s Networx program includes the largest telecommunications contract vehicles ever awarded by the federal government. CenturyLink recently secured an extension through spring 2020 of its offerings available to federal government agencies via GSA’s Networx Universal and Enterprise contracts. GENBAND’s EXPERiUS™ Application...
Jul. 25, 2016 12:00 PM EDT Reads: 1,810
IoT generates lots of temporal data. But how do you unlock its value? You need to discover patterns that are repeatable in vast quantities of data, understand their meaning, and implement scalable monitoring across multiple data streams in order to monetize the discoveries and insights. Motif discovery and deep learning platforms are emerging to visualize sensor data, to search for patterns and to build application that can monitor real time streams efficiently. In his session at @ThingsExpo, ...
Jul. 25, 2016 11:00 AM EDT Reads: 896
Verizon Communications Inc. (NYSE, Nasdaq: VZ) and Yahoo! Inc. (Nasdaq: YHOO) have entered into a definitive agreement under which Verizon will acquire Yahoo's operating business for approximately $4.83 billion in cash, subject to customary closing adjustments. Yahoo informs, connects and entertains a global audience of more than 1 billion monthly active users** -- including 600 million monthly active mobile users*** through its search, communications and digital content products. Yahoo also co...
Jul. 25, 2016 10:30 AM EDT Reads: 283
"There's a growing demand from users for things to be faster. When you think about all the transactions or interactions users will have with your product and everything that is between those transactions and interactions - what drives us at Catchpoint Systems is the idea to measure that and to analyze it," explained Leo Vasiliou, Director of Web Performance Engineering at Catchpoint Systems, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York Ci...
Jul. 25, 2016 10:30 AM EDT Reads: 1,935
"Tintri was started in 2008 with the express purpose of building a storage appliance that is ideal for virtualized environments. We support a lot of different hypervisor platforms from VMware to OpenStack to Hyper-V," explained Dan Florea, Director of Product Management at Tintri, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jul. 25, 2016 10:15 AM EDT Reads: 1,864
The best-practices for building IoT applications with Go Code that attendees can use to build their own IoT applications. In his session at @ThingsExpo, Indraneel Mitra, Senior Solutions Architect & Technology Evangelist at Cognizant, provided valuable information and resources for both novice and experienced developers on how to get started with IoT and Golang in a day. He also provided information on how to use Intel Arduino Kit, Go Robotics API and AWS IoT stack to build an application tha...
Jul. 25, 2016 10:00 AM EDT Reads: 980
SYS-CON Events announced today that LeaseWeb USA, a cloud Infrastructure-as-a-Service (IaaS) provider, will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. LeaseWeb is one of the world's largest hosting brands. The company helps customers define, develop and deploy IT infrastructure tailored to their exact business needs, by combining various kinds cloud solutions.
Jul. 25, 2016 09:45 AM EDT Reads: 1,127
Whether your IoT service is connecting cars, homes, appliances, wearable, cameras or other devices, one question hangs in the balance – how do you actually make money from this service? The ability to turn your IoT service into profit requires the ability to create a monetization strategy that is flexible, scalable and working for you in real-time. It must be a transparent, smoothly implemented strategy that all stakeholders – from customers to the board – will be able to understand and comprehe...
Jul. 25, 2016 09:30 AM EDT Reads: 2,102
The cloud market growth today is largely in public clouds. While there is a lot of spend in IT departments in virtualization, these aren’t yet translating into a true “cloud” experience within the enterprise. What is stopping the growth of the “private cloud” market? In his general session at 18th Cloud Expo, Nara Rajagopalan, CEO of Accelerite, explored the challenges in deploying, managing, and getting adoption for a private cloud within an enterprise. What are the key differences between wh...
Jul. 25, 2016 09:15 AM EDT Reads: 2,001
SYS-CON Events announced today that Venafi, the Immune System for the Internet™ and the leading provider of Next Generation Trust Protection, will exhibit at @DevOpsSummit at 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Venafi is the Immune System for the Internet™ that protects the foundation of all cybersecurity – cryptographic keys and digital certificates – so they can’t be misused by bad guys in attacks...
Jul. 25, 2016 08:30 AM EDT Reads: 1,274
Large scale deployments present unique planning challenges, system commissioning hurdles between IT and OT and demand careful system hand-off orchestration. In his session at @ThingsExpo, Jeff Smith, Senior Director and a founding member of Incenergy, will discuss some of the key tactics to ensure delivery success based on his experience of the last two years deploying Industrial IoT systems across four continents.
Jul. 25, 2016 06:00 AM EDT Reads: 1,497
There will be new vendors providing applications, middleware, and connected devices to support the thriving IoT ecosystem. This essentially means that electronic device manufacturers will also be in the software business. Many will be new to building embedded software or robust software. This creates an increased importance on software quality, particularly within the Industrial Internet of Things where business-critical applications are becoming dependent on products controlled by software. Qua...
Jul. 25, 2016 05:45 AM EDT Reads: 1,376
SYS-CON Events has announced today that Roger Strukhoff has been named conference chair of Cloud Expo and @ThingsExpo 2016 Silicon Valley. The 19th Cloud Expo and 6th @ThingsExpo will take place on November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. "The Internet of Things brings trillions of dollars of opportunity to developers and enterprise IT, no matter how you measure it," stated Roger Strukhoff. "More importantly, it leverages the power of devices and the Interne...
Jul. 25, 2016 05:00 AM EDT Reads: 2,020
Machine Learning helps make complex systems more efficient. By applying advanced Machine Learning techniques such as Cognitive Fingerprinting, wind project operators can utilize these tools to learn from collected data, detect regular patterns, and optimize their own operations. In his session at 18th Cloud Expo, Stuart Gillen, Director of Business Development at SparkCognition, discussed how research has demonstrated the value of Machine Learning in delivering next generation analytics to imp...
Jul. 25, 2016 04:15 AM EDT Reads: 2,410
In addition to all the benefits, IoT is also bringing new kind of customer experience challenges - cars that unlock themselves, thermostats turning houses into saunas and baby video monitors broadcasting over the internet. This list can only increase because while IoT services should be intuitive and simple to use, the delivery ecosystem is a myriad of potential problems as IoT explodes complexity. So finding a performance issue is like finding the proverbial needle in the haystack.
Jul. 25, 2016 03:45 AM EDT Reads: 2,197
The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform. In his session at @ThingsExpo, Craig Sproule, CEO of Metavine, demonstrated how to move beyond today's coding paradigm and shared the must-have mindsets for removing complexity from the develo...
Jul. 25, 2016 01:45 AM EDT Reads: 1,261
SYS-CON Events announced today that MangoApps will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. MangoApps provides modern company intranets and team collaboration software, allowing workers to stay connected and productive from anywhere in the world and from any device.
Jul. 25, 2016 01:30 AM EDT Reads: 1,270
Basho Technologies has announced the latest release of Basho Riak TS, version 1.3. Riak TS is an enterprise-grade NoSQL database optimized for Internet of Things (IoT). The open source version enables developers to download the software for free and use it in production as well as make contributions to the code and develop applications around Riak TS. Enhancements to Riak TS make it quick, easy and cost-effective to spin up an instance to test new ideas and build IoT applications. In addition to...
Jul. 25, 2016 12:30 AM EDT Reads: 1,896