Jump to content

# procedural Procedural Potion Bottle Tool

## Recommended Posts

I've been learning a lot of vex over the past couple of months and this is my first real practical use trying to make a procedural tool. Let me know what you think!

Next iteration is to add more curved lines using trigonometry instead of smooth.

#### Share this post

##### Share on other sites

Turns out the first real 200 lines of code that I wrote for iteration 1.0 had a lot of mistakes (apparently the green marks on the scroll bar add up). So I decided to rewrite it all and this time use custom expressions(?) to help with readability. I've also stopped with the strong reliance on both smooth and custom input graphs, now I'm using different variations of trigonometry to decide how the potion bottle will bend, which means the bottles look a lot similar over different levels of detail. Instead of custom input graphs I've plotted various graphs of probability, cast it as a vector with 3 different seeds in case I need the same graph again but with a different number, and then fit aand clamped it to my need.

As well as this I've added more shapes to the bottles options. Instead of only having 50% chance square and 50% chance circle it now has a 33% chance square, 33% circle and a 33% chance to be a triangle, pentagon, hexagon or octagon but I'm thinking of tweaking these percentages. The overall width of the bottles has been streamlined to a single random input with a seed to aid in fitting them across a shelf instead of the width depending on inputs from the neck scale and height, because of this I haven't added the height property at the moment.

Not as important but kinda neat, to keep my code more organised I've also added more comments and even pictures to help, seen below.

Next I need to clean up a few things in the code, add a height property which includes in it the different bottle tops, add a few missing things from the first iteration and then add thickness to the glass.

#### Share this post

##### Share on other sites

Nice, bug fixes done. Had to ditch the triangle shape as it caused too much of a headache when it came to a linear interpretation with a circle and added a simple heptagon (a decagon just comes out as a circle). However, I might add a twist possibility now that the triangle is removed. The lowest level of detail is still a bit naff so I'm gunna have to look into that a bit and the high level of details above 6 or so lack something to be desired but I think it'll be fine as the level of detail is just a happy benefactor of having a procedural asset and not the end goal (the end goal, not previously stated, is somewhere between Snapes office and Shrek 2 fairy god mothers factory).

To continue I'm gunna work on the shading at the moment, to get something nice to show. Although something to consider is that some potion bottles are painted clay which'll mean I'll need to soften some of the sharp edges .

#### Share this post

##### Share on other sites

Forgot to post my results yesterday, finished the rough glass shader although I need to find a way to randomize the texture of the glass a bit better. I might try to export the potion bottles seed then feed it into the shader and randomize the postion, but I'm not sure how the shader will cope, shading multiple bottles with a different value for each. Still having trouble with the neck geometry extruding downwards sometimes, it's a painfully easy fix but for some reason it keeps happening. I'm finding these blog posts in this forum really helpful though as I end up sticking to the thing I set out to do in the previous post. Yesterday I started on trying to create chipping on the glass where the mean curvature, curves outwards more using a scatter and a cluster sop and realised I hadn't developed the rough glass shader past the displacement, the lights and background. Almost treating lighting and rendering as its own thing! And not just an oh shit after thought.

Anyway, today I'm gunna try fix the neck geo (you can see it being weird in pictures 3 and 4) once and for all. Then make the rest of the shaders: Amber glass, Green Glass, Aged yellowing glass, Clay, brass stopper and use someones tiled cork texture to tri-planer a cork top (feels like cheating, but it's what I'd of done for a client and making cork would feel like a whole other project. I've only used substance designer twice and never used cops so it'd feel like a whole other project). Then I might redo my lame dust shader, should be able to do this all in a day but who knows. If I get time I'll finish my glass chipping code.

DHR

#### Share this post

##### Share on other sites
Posted (edited)

Here we go, didn't get a chance to make a clay material (opaque in yellow). The amber material doesn't really work and the random values for some of the the potions liquid and the randomly coloured glass bottles (you can see the randomly coloured glass bottle in red bottom right) I might be able to fix this by multiplying them by normalizing times by 2 and clamping the vector but I also I might just ditch the coloured glass or turn the transparency down for them. The dirt and dust shading became too dominant so I limited it quite a lot and now it's barely visible so i'll have to fix that.

The biggest issues are with the horizontal periodic artifacting on some of the glasses as well as some of the glass tops show some greyishness.

After I've fixed all of these issues I'll finish the glass chipping and then work on the procedural labels I've started but gave up on before.

Edited by DHartleRyan
forgot about an issue
• 1

#### Share this post

##### Share on other sites

That's a lot of bottles

• 1

#### Share this post

##### Share on other sites

Something I've been wondering since I put in trigonometry interpretation, giving me a rounded objects where there would be just a straight line , is "why am I not getting circles?". All the code is there with the probability to give me a 1/9 chance of having a bulb at the bottle of the neck (with 1/36 for a fully round bulb), but I just wasn't getting any. Turns out

`vector hillProb = chramp("HillProbability",rand(seed+2));`

doesn't give me 3 random values, just 1 three times. Even though rand(seed+2) will give you a random vector (it does say in the documentation though). But if you use

```float hillProb = chramp("HillProbability",rand(seed+2));
float hillProb1 = chramp("HillProbability",rand(seed+30));
float hillProb2 = chramp("HillProbability",rand(seed+400));```

it works perfectly well.

#### Share this post

##### Share on other sites
1 hour ago, DHartleRyan said:

Something I've been wondering since I put in trigonometry interpretation, giving me a rounded objects where there would be just a straight line , is "why am I not getting circles?". All the code is there with the probability to give me a 1/9 chance of having a bulb at the bottle of the neck (with 1/36 for a fully round bulb), but I just wasn't getting any. Turns out

```
vector hillProb = chramp("HillProbability",rand(seed+2));```

doesn't give me 3 random values, just 1 three times. Even though rand(seed+2) will give you a random vector (it does say in the documentation though).

It's because the ramp is a float. You are saying that vector = float. If you skip the ramp and do vector hillProb = rand(seed+2); you will get a random vector.

#### Share this post

##### Share on other sites
1 hour ago, Skybar said:

It's because the ramp is a float. You are saying that vector = float. If you skip the ramp and do vector hillProb = rand(seed+2); you will get a random vector.

By skipping the ramp I skip the rate of probability in the graph. It would just give me a linear probability

#### Share this post

##### Share on other sites
Posted (edited)

Stacking the shelves

Don't worry I will use instancing for the final project

Edited by DHartleRyan

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

×
• Donations

• Leaderboard