Jump to content

Procedural Potion Bottle Tool


Recommended Posts

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.

Procedural Potions 2.0

Annotation 2020-05-19 115543.png

Annotation 2020-05-19 115544.png

Link to comment
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 .

 

Potions Iteration 3

level of detail to 9.png

Link to comment
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 

potionsTestRender_01.png

potionsTestRender_02.png

potionsTestRender_03.png

problem.png

Link to comment
Share on other sites

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.

potionsTestRender_04.png

Edited by DHartleRyan
forgot about an issue
  • Like 1
Link to comment
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.

bulbPotions.png.23411cc2c077a73707d8dc0d52a0d5f7.png

Link to comment
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.

Link to comment
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

rate of probability.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...