• Welcome to World Machine Community. Please login or sign up.
 
July 15, 2019, 09:42:09 pm

News:

Read the Development Diary for an inside look at World Machine's progress!


Adding Integers

Started by puckducker, June 02, 2014, 02:46:28 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

puckducker

Is there any way to add integers together, the way you would do with scalar values? I have a complex setup that I'm using an integer as a Seed input (don't want to use Randomize as I want to be able to control the seed value). However, because it's a complex setup that means that I've got 30 or 40 perlin noise generators with the exact same seed value, and thus are creating more or less the exact same shape....not exactly ideal for my randomized setup, as I'm hoping for lots of happy accidents as different noises combine in different ways.

What I figured I could do is just add a +1 to that integer/seed value before plugging it into the input of the noise generators. That way each noise would have a different seed value, but they would all ultimately tie back to 1 single, seed number. But so far I cannot find anyway to add 2 integers together.

Any thoughts?

Stephen

Unfortunately the number of devices that can work with Integer types are rather limited.

However, WM casts scalars to integers when a scalar parameter is hooked up to an integer input: This means you can use a scalar to supply your seed values, which allows you to use the Scalar Arithmetic device to do what you want.

The only caveat here is the usual imprecision of a floating point type; but as long as your float stays exactly the same it should cast to the same integer always..
-- Stephen Schmitt
- Creator of World Machine

puckducker

Is there a way to convert an integer value to a scalar? Since the range of integer value's is clamped to 0 - 65535, then could we translate that to a 0 - 1 scalar value?

Your suggestion about using a scalar as a seed value works well, but unfortunately I have to start with an integer value as it's being supplied from outside WM to begin with

puckducker

I suppose I could always create a network of 65535 "Integer Equals" devices to just manually convert each possible integer value....but that would probably be excessive

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S save/post or ALT+P preview