Be the Creator of your world
PixelsWorld documentation version: v3.6.0
Author ZzStarSound
History
v2.3.1
v1.0
中文版
日本語
Welcome to PixelsWorld!
We have compressed all essence of how to use PixelsWorld in this section. If you master it, you will be a new creator of PixelsWorld!
Simply speaking
PixelsWorld renders graphics basing on your code
Here are some key points you have to know.
- PixelsWorld is like a simple Game Engine.
- All code provided by you will run in a Lua engine.
- Writing code in PixelsWorld is like writing a powerful Expression. PixelsWorld supports:
- PixelsWorld is almost the "Wrangle Node" if you are familiar with Houdini.
- PixelsWorld can draw simple 2D/3D geometries. Details >>>
Video tutorials
We highly recommend starting with watching our basic tutorial.
Lua Example: Drawing a house
Here we give a code example of drawing a house in Lua mode.
DrawHouse3.lua
version3() -- Use version 3, always call this in the first line.
move(width/2, height/2) -- Move the Paintbrush to the center of your screen
rotateX(PI) -- Rotate Paintbrush Coordinate along X axis 180 degrees
fill(1,1,0) -- Apply yellow pigment (Red=1,Green=1,Blue=0)
rect(100) -- Draw a 100x100px square
fill(1,0,0) -- Use red pigment(Red=1,Green=0,Blue=0)
move(0,50) -- Move the Paintbrush Coordinate 50px upwards
tri(150,100) -- Draw a isoceles triangle in 150px of base, 100px of height.
Here we want to add some extra controls to the scene like color combination controllers of our house.
DrawHouse3.lua
version3() -- Use version 3, this is what you always have to call in the first line.
move(width/2, height/2) -- Move the Paintbrush Coordinate to the center
rotateX(PI) -- Rotate Paintbrush Coordinate along X axis 180 degrees
fill(color(0)) -- Use color #0
rect(100) -- Draw a 100x100px square
fill(color(1)) -- Use color #1
move(0,50) -- Move the Paintbrush Coordinate 50px upwards
tri(150,100) -- Draw a isoceles triangle in 150px of base, 100px of height.
Then click the Ok button, the house will... disappear!
Indeed, our house is still drawn onto the layer, but because the default color of the color controller is black, so as a result, the house seems to disappear.
To fix it, open the Parameter list, find the first 2 Color controllers, change them to whatever you want.
Mayor is me! Draw more houses
One tremendous advantage of code is the capability of handling repetitive operations.
Needless to say, Lua language allows you to write looping code.
DrawHouse3.lua
version3() -- Use version 3, this is what you always have to call in the first line.
move(width/2, height/2) -- Move the Paintbrush Coordinate to the center
rotateX(PI) -- Rotate Paintbrush Coordinate along X axis 180 degrees
for i=1,3 do -- Begin repeat (3 times)
fill(color(0)) -- Use color #0
rect(100) -- Draw a 100x100px square
fill(color(1)) -- Use color #1
move(0,50) -- Move the Paintbrush Coordinate 50px upwards
tri(150,100) -- Draw a isoceles triangle in 150px of base, 100px of height.
move(0,-50) -- Move the Paintbrush Coordinate back
move(175,0) -- Move the Paintbrush Coordinate 175px rightward
end -- End repeat
If you don't want to write functions like "move back". Write in this way:
DrawHouse3_1.lua
version3() -- Use version 3, this is what you always have to call in the first line.
move(width/2, height/2) -- Move the Paintbrush Coordinate to the center
rotateX(PI) -- Rotate Paintbrush Coordinate along X axis 180 degrees
for i=1,3 do -- Begin loop (3 times)
fill(color(0)) -- Use color #0
rect(100) -- Draw a 100x100px square
fill(color(1)) -- Use color #1
beginGroup() -- NEW LINE! Begin to record transformations of Paintbrush Coordinate
move(0,50) -- Move the Paintbrush Coordinate 50px upwards
tri(150,100) -- Draw a isoceles triangle in 150px of base, 100px of height.
endGroup() -- NEW LINE! This line will automatically calls 'move(0,-50)'
move(175,0) -- Move the Paintbrush Coordinate 175px rightward
end -- End loop
Finally, we want to give the controllers names:
Save code as a preset.
Note: The Administrator mode is required in this step if you installed Ae into the disc where your system files are (like
C:\
).
First of all, add a new Preset column into the popup list:
Then, save your preset into the newly created Preset column:
Apply preset
Select the preset you want to apply, click the Replace button in Presets review area.
Congratulations!
You have already mastered almost all of PixelsWorld.
>>> Next step: Go to the lua chapter for more details
>>> Next step: Open the Pandora's Box of shader