Playblast in Blender

Final render can be time-consuming and be taxing on the hardware, It is not recommended when you have to show mechanics or need a much quicker or instant render. An alternative to Final Render is Viewport render also known as Playblast amongst animators.

Viewport render is quick as it renders with OpenGL. It also gives an option to render parts that are never visible in the final render like empty(null object) letting animators display rig mechanics in their showreels and teammates.

In Blender the viewport render is known as “OpenGL Render”, it gives you two options the first is “OpenGL Render Image” that renders the viewport as still, the second one is “OpenGL Render Animation” which lets you render the animation.

To render a still, go to Render > OpenGL Render Image

You can also go into the viewport header and click on the shortcut instead of navigating all the way to the menu.

The default scene should look something like this.

By default, it renders the complete viewport it is similar to taking a screenshot.

Controlling the viewport render is quite simple, the settings are in the N-panel. Things like Ambient Occlusion and MatCap can also be assigned and it will be part of the viewport when executed. You can also disable displaying of certain elements like Empty by tick marking the “Only Render” switch.

A customized viewport render looks like this of the “default scene”.

How to create a sketch app in JavaScript using P5.JS

I have been learning P5.JS for a while now and though it would be nice to share the process and progress in form of a tutorial, which will motivate me to continue learning and give others access to it.

We will learn how to create a sketch app. I have kept it as basic as I can, this makes it easy to understand and quick to create.

To follow this tutorial you need to know basics of HTML and JavaScript.

Let’s start with What is P5.JS?

P5.JS is a javascript library based on Processing which was originally written in Java, for creating interactive applications, the reason to create such a framework was to make coding accessible for artists, educators, and beginners, over the years there have been many ports of this framework in different languages and P5 is one of them.

First, we need to get P5.JS(minified version), we are going with minified version because it contains the complete library in the smallest footprint possible.

Creating the bare-bone structure of the project

index.html lib/p5.min.js

We will then create run.js, this file will contain all the code we will be writing.

Our project should look something like this.

index.html lib/p5.min.js run.js

Time to write some HTML in the index.html file.

<meta charset="UTF-8">
<title>Sketch App</title>
<style>
    body {padding: 0; margin: 0;} canvas {vertical-align: top; border: 2px solid #000;}
</style>
<script type="text/javascript" src="lib/p5.min.js"></script>
<script type="text/javascript" src="run.js"></script>

As you can see above we have the p5.js library before run.js, since web browsers read code line by line it is important that the library is interpreted before run.js, otherwise all the code we have written will contain error because the web browser does not know what we are trying to do.

In P5.JS all the naming convention is followed based on what the function does and what it contains, this makes it easy to understand to a beginner.

It’s time to edit the run.js file.

The first function will be setup(). This will contain all the code that will initialize the program more like rules and instruction to follow.

function setup() { }

We will create the draw() function below setup(). The draw function will contain all the drawing tasks that will be running inside the canvas element that we will create in the next step.

function draw() { }

The code should look something like this.

function setup() { }

function draw() { }

Creating the canvas inside setup() using createCanvas() function.

The createCanvas() element takes two parameters, width, and height.

function setup() { 
    createCanvas(800, 800); // width, height 
}

If you open the web page you will see a white box with a size of 800 x 800 surrounded by a border of 2px.

You can change the background color using the background() function that takes one parameter.

function setup() { 
    createCanvas(800, 800); 
    background(85); // you can choose between 0 and 255. 
}

Let’s add some functionality to draw() which will make the magic happen.

function draw() { 
    if(mouseIsPressed) { 
    rect(mouseX, mouseY, 2,2) // X location, Y location, weight, height 
    } 
}

As you can see in the above code we have an if statement that has the mouseIsPressed function, this function checks if the mouse is pressed, using the if statement we are telling it to draw a rectangle with the rect() function on the X axis and Y while maintaining a width and height of 2px.

With the fill() function, we will make rect have its interior have white color.

function draw() { 
    if(mouseIsPressed) { 
        fill(255); / Choose between 0 to 255 rect(mouseX, mouseY, 5,5) // X location, Y location, weight, height 
        } 
}

We can remove the stroke around the rectangle by adding a noStroke() function, this will remove the stroke surrounding the rect we draw.

function draw() { if(mouseIsPressed) { 
        fill(255); // Choose between 0 to 255 noStroke(); 
        rect(mouseX, mouseY, 5,5) // X location, Y location, weight, height } 
}

The project is done. Good job!

The complete code in run.js should look like the snippet below.

function setup() { 
    createCanvas(800, 800); 
    background(85); 
} 
function draw() 
    { 
        if (mouseIsPressed) 
            { 
                fill(255); 
                noStroke(); 
                rect(mouseX, mouseY, 5, 5); 
    } 
}

This is how the final version should look.

You can download the completed source code of this project from GitHub.

Happy Coding and Happy New Year.

Remove all installed Homebrew packages

Keeping your Mac clean can be a difficult task if you use Homebrew to install packages for development and testing purpose and without correctly installing the right packages, it may bloat your system, taking up unwanted storage space.

This one command will uninstall all the packages install through Homebrew.

brew remove --force $(brew list) --ignore-dependencies  

You can also run.

brew list -1 | xargs brew rm

To remove unused archives run.

brew cleanup  

To remove Cask packages

brew cask remove --force $(brew cask list)

If you have any question, leave a comment.

How to render wireframe in Maya

Rendering wireframes can be a great way to showcase your model or modeling skills, especially when you have to display renders of your work in a showreel or your portfolio.

A quick video on the entire process

Maya ships with Maya Vector renderer, which lets you render vector and also offers the option to render the wireframe, which means you can render wireframe of your model without having to use a third-party plugin or external renderer.

How to do it.

Go to the render settings window, by clicking the last icon.

Switch to Maya Vector from the renderer drop down menu.

Now the render settings window should look like this.

Go to the Edge Options.

Enable Include edges.

Now click on render, now you will get a similar to the image below.

The final output should look like this.

Thank you for reading.

VBO in Blender

Working with heavy topology and large projects with too much geometry can slow down your viewport, which at times might be quite irritating, especially when you have too much geometry and have to fix minor issues. This can be avoided by enabling VBO (_V_ertex _B_uffer _O_bject) which is a nice feature in Blender. To make things simple VBO is a simple process in OpenGL that uploads vertex data (position, normal vector, color, etc.) to the graphics card instead of the system memory. This can have a big impact on performance by reducing lag, it can also let your hardware handle more geometry, because of a dedicated piece of hardware optimized for handling such tasks. Modern graphics cards are designed for handling the intense load (rendering, baking, etc). However, it is not recommended to have VBO enabled if you are using old graphics cards that have outdated drivers or those that are not supported by the vendor.

In Blender release 2.77 this feature is enabled by default and cannot be disabled (the option has been removed).

Here is a video to show how this helps.

Enabling VBO

Go to File>User Preferences

Head over to the System tab.

Blender User Preference

Tick the VBOs box, this will enable VBO.

VBO option zoom

VBO has been enabled now you would see an improvement in performance. Thank you for reading, If you have any questions feel free to leave a comment below

Good Bootstrap practices

programming language

Bootstrap is a CSS(Cascading Style Sheets) library developed by Twitter that lets you create responsive websites with easy to understand naming convention and well-designed grid system.

It has gained popularity due to its easy of use and pre-processor support, here are some good practices that will make your Bootstrap powered environment clean and easy to manage and maintain.

Use PreProcessors

Bootstrap offers Less based builds, these builds let you choose what modules you require and are needed to be enabled and helps you override the style sheets with writing lesser lines of the stylesheet.

Things like colors of text and background color of elements classes like navbar can be changed by changing the information stored in the variables.

Use of PreProcessors can make your Bootstrap lighter and have a cleaner code base, that is not bloated by the defaults.

Use scripts depending on the structure and modules

What I mean to say is if you website does not contain large amount of Bootstrap, then don’t use the bootstrap.min.js instead use the individual module files in development and later minify them to one file in production, so if you have a bootstrap based drop-down menu, you don’t have to use the complete bootstrap JavaScript library and only use the dropdown.js with its helper files.

This will make your website lighter and less bloated with things that are not going to be used and the client has a smaller file to render.

These are all the major steps I take while developing a website with Bootstrap.

Thank you for reading,

If you have any question feel free to leave a comment below.

WordPress with SQLite

monitor showing Java programming

WordPress is a free open source CMS (Content Management System) written in PHP and uses MySQL, WordPress is one of the most popular CMS, It does not support any other database other than MySQL, Due to a lack of support for any other Database, It sometimes turns into a problem when the user wants to have WordPress installed but does not have MySQL database for various reasons sometimes the Web Server is not powerful enough to handle MySQL or the hosting service does not offer MySQL in certain plans. Certain hosting service runs the MySQL database in a separate data center which can sometimes be slow to fetch the data or might slow the WordPress system completely on higher traffic.

Also read bout, My experience with WordPress SQLite.

How do we achieve this?

However, a WordPress plugin developer kjmtsh developed a plugin SQLite Integration which lets you run WordPress with SQLite, a file based alternative to MySQL which is faster, consumes lesser system resource. So now you can run WordPress with SQLite. _I have tried this plugin with a fresh WordPress install and did not try to migrate an existing MySQL based WordPress install. So I don’t recommend trying it on an existing WordPress install with MySQL.

Getting started

Get WordPress.

First, grab a copy of WordPress from here and expand the files in into Webroot or wherever your website source is stored.

Get the SQLite plugin

Now get the SQLite integration plugin from here and expand the files.

Setting up and activating the plugin

Now place the SQLite Integration plugin folder in your wp-content/plugins directory.

Copy the db.php file found in the sqlite-integration folder to wordpress/wp-content folder.

Rename wordpress/wp-config-sample.php to wordpress/wp-config.php.

You can use these parameters to configure what the database should be named and where it should be located, by default the database is named .ht.sqlite stored in wp-content/database/

Extra setting options

SQLite database file name settings.

define('DB_FILE', 'your_database_name');  

Database storage directory

define('DB_DIR', '/home/youraccount/database_directory/');  

Visit your WordPress install and you should be greeted with a setup page.

You can enable the SQLite plugin on the plugins page and visit the Miscellaneous page and optimize the database every time there is a new plugin installed/removed or there is a need to do a database cleanup.

optimize will drop the size of the database by only keeping the required content of posts, pages, and plugins, this will improve the performance of WordPress overall.

Now you have WordPress running on SQLite installed on your system.

If you require patches or issue tracking visit here.

NeoVim on Fedora 21

NeoVim is an open source project to rebuild Vim but with better plugin support and more efficiency for more information over the project visit here

Installing

Logging in as administrator.

 su –  

Adding the Neovim repo for Fedora.

gedit /etc/yum.repos.d/rorgoroth-neovim-fedora-21.repo

Add the following lines in the
rorgoroth-neovim-fedora-21.repo

[rorgoroth-neovim]  
name=Copr repo for neovim owned by rorgoroth  
baseurl=https://copr-be.cloud.fedoraproject.org/results/rorgoroth/neovim/fedora-$releasever-$basearch/  
 skip_if_unavailable=True  
 gpgcheck=1  
 gpgkey=https://copr-be.cloud.fedoraproject.org/results/rorgoroth/neovim/pubkey.gpg  
enabled=1  

Save the file.

Installing NeoVim.

 yum install neovim  

If you have any questions feel free to leave a comment below.

rTorrent on Raspberry Pi

rTorrent is a command line ncurses BitTorrent client written in C++, based on the libTorrent. rTorrent is very lightweight and has a very clean command line user interface. rTorrent is also one of the most lightweight BitTorrent clients used by most of the BitTorrent distribution servers. rTorrent is a really good BitTorrent client for Raspberry Pi. rTorrent is lighter and faster compared to BitTorrent clients like Transmission, Deluge and takes lesser CPU resource.

rTorrent performs better on the tests I have done on my Raspberry Pi. The Raspberry Pi I have been using is a Model B.

Let’s get started

Updating your local repository database.

sudo apt-get update

Installing screen and rTorrent. If you are a Tmux user you can go ahead and use it instead of the screen.

sudo apt-get install screen rtorrent  

Now create a rtorrent.rc file.

touch ~/.rtorrent.rc  

Open the file in nano and add the example config below.

nano ~/.rtorrent.rc  

Here is an example config of .rtorrent.rc.

You can edit the `.rtorrent.rc as per your needs.`

Now we can start using rTorrent.

screen rtorrent  

You can detach to the rtorrent screen by typing CTRL + A + D.

To connect back to the rTorrent screen.

screen -r 

To add a BitTorrent simply hit ENTER

Now you have you rTorrent running on your Raspberry Pi. If you have any question feel free to leave a comment below.

Sitemap for Wintersmith

Sitemap helps Search Engine index your website. It give the search engine a list of all the links available.

If you don’t have a sitemap your website might not be indexed correctly and only some links will be shown in search result. Wintersmith is a really good static site generator. I have written a template for it that generates the sitemap.xml file so search engines can index your website. All you need to do is to clone this github repo and copy the sitemap.json from the contents directory and places it into your website source contents directory. Next copy the sitemap.jade from templates directory and place it in your website source templates directory. This will automatically generate the sitemap required for your website.