Sending emails in Django with Namecheap cPanel email account

This guide is aimed at those who want to use their Namecheap cPanel email server to send out Django emails. I have found little to no documentation on this specific task and therefore would like to share my findings.

There are two steps to this process:

  1. Create your email account
  2. Add appropriate email settings to settings.py

Step 1:

Navigate to your cPanel and create a email account (this is documented by Namecheap here). You will need to remember three things:

  • Full email address (EMAIL_HOST_USER)
  • Password (EMAIL_HOST_PASSWORD)
  • cPanel url from your browser (EMAIL_HOST)

Step 2:

Populate settings.py file with following variables:

# Email settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'premium203.web-hosting.com'
EMAIL_PORT = 465
EMAIL_USE_SSL = True
EMAIL_USE_TLS = False
EMAIL_HOST_USER = 'your-new-email@yourdomain.com'
EMAIL_HOST_PASSWORD = 'your-email-password-for-this-account'

Important note: Namecheap offers “private email” (also known as business email). This service is different from your Namecheap cPanel email account and will require different settings. If you’re setting up your private email, then here is a Stackoverflow answer that should get you going.

Hope this helps.

Read MoreSending emails in Django with Namecheap cPanel email account

WebP Case Study: 60% increase in webpage performance

2023 internet is bloated. As the hardware improves and network speeds increase — JavaScript developers are tirelessly finding new and creative ways to significantly slow down webpages around the globe. WebP comes to the rescue by reducing image sizes (in most cases).

WebP is an open image format (like jpg, png) released in 2018. Though adoption has been slow initially, in 2023 all major browsers have adopted WebP standard natively.

Only two browsers do not support WebP as of January 2023

  • KaiOS
  • Internet Explorer
WebP Supported Browsers Table

Testing method

To put WebP to the test, we are going to use a performance rubric within Lighthouse Developer Tool in Google Chrome. The site we will test is a static one-page html website with a bunch of hefty jpegs: driftbasic.com

The test is simple:

  • Run Lighthouse on the original page
  • Convert most images to WebP
  • Re-run Lighthouse on the updated page

The original page was slow:

Boasting large jpeg images and painfully slow loading speeds amounting to an overall performance score of 61.

Lighthouse Score Before WebP

Not all images will benefit from a conversion to WebP

Unfortunately not every image will benefit from being converted to WebP. This is especially true if you have already followed good practices for optimizing your image for web prior to attempting WebP conversion.

From my personal experience of converting over a 100 images to WebP — only two resulted in a larger size. One of them happens to be the largest jpeg image in this case study

Visual comparison of jpeg vs webp

So far I am unable to figure out exactly why this happens with some outliers.

End result is a faster page

The other 5 images were converted from jpeg to WebP without any issues

  • Image 1: from 78.7kb to 50kb
  • Image 2: from 62.3kb to 31.3kb
  • Image 3: from 72.0kb to 39.0kb
  • Image 4: from 70.1kb to 37.8kb
  • Image 5: from 260kb to 48.3kb
  • Overall: from 543kb to 206kb
Lighthouse score after conversion to webp: 99

This is conversion resulted in approximately 60% performance improvement đź‘Ź Try it on your website (By the way, WordPress has some helpful plugins to help you do this).

Read MoreWebP Case Study: 60% increase in webpage performance

How to make business cards at home

Printing business cards at home is pretty simple. All you need is a printer and some specialized paper that you can pick up on Amazon. I am using Avery #28877 which will yield 120 business cards. My printer is HP Envy 4520.

Avery Business Cards for Printing at Home with Clean Edge

1. Create new project

Once you have you have purchased your paper navigate to Avery website and create an account. Then navigate to projects and press create new project.

2. Select your template and design

Type in 28877 in the search bar and select one-sided template. Now you can select your design from 1500+ per-existing ideas or create your own from scratch.

3. Get PDF and Print

The results are really good. This is my favorite method for printing custom business cards in small batches.

Read MoreHow to make business cards at home

Why phone applications are so expensive to develop?

“Technology is getting smaller, faster, cheaper, and more powerful every day.”

-Tae Yoo

Then why are phone applications are still so expensive to develop and maintain? Following are top four reasons a simple app will cost you over $40,0001 to develop in 2022:

Development process is involved

Have you noticed that most app developers focus on either Android or iOS? This is because developing apps for either platform is relatively involved. Tools needed to develop and app for either platform have a steep learning curve and they are not interchangeable.

Each platform has unique quirks and features that evolve quickly and developers have to keep up with these changes. As a result most developers choose to specialize in a single platform.

You have to pay (at least) twice

Unless you’re targeting only Android (or Apple) users, you will have to develop this application twice. This is roughly double the cost and triple the headache.

Most applications with require some infrastructure (as an example a database and payment gateway). The infrastructure will have to play nice with both platforms and can get very costly. Especially complex projects may require hiring additional developers that specialize in this area.

UI/UX R&D is hard

User interface & user experience are key factors in the success of an app. A good app

  • has to get the job done (better than any alternative)
  • and be user friendly & easy to learn

This is difficult to achieve especially when you’re working with a small touch screen. Well made applications undergo iterative development with consistent user testing ($$$).

Consider this: with an already over-saturated app store, users are not excited to bloat their phone with yet another app. Just think of all of the useless, broken, and poorly designed apps that frustrated you in the past. Would you give any of those apps a second chance? This this exactly why you can not skip costly & time consuming user testing along every development stage.

Post-development maintenance

The mobile world evolves fast and your development team with have to keep up. Different screen resolutions, physical features, operating systems, and developments tools are among many ever changing variables.

It is not enough to develop a phone app. You will also have to maintain and update it. Bugs and problems are inevitable and will have to be fixed quickly.

Developing an application is not a one-time cost. The budget must account for a team of software developers on staff after launching your app.

TL;DR

Phone applications are expensive to develop. UI/UX research is lengthy, infrastructure can get complex very quickly, and you have to develop your app twice. Once for an Android and another for an iOS iPhone. Following the initial development, the app will need continuous updates and bug fixes.

All of this is not to say that you should not develop an app. It is to say that you should triple check your idea. Are you absolutely sure that a phone application is the best way to bring your idea to life?

Sources:
  1. How Much Does It Cost to Develop an App in 2022? Cost Breakdown, September 2022. https://spdload.com/blog/app-development-cost/?doing_wp_cron=1664155965.5226879119873046875000
Read MoreWhy phone applications are so expensive to develop?

Why choose WordPress for a small business web site in 2022

WordPress is an open-source content management system that is used by 42.9% of all websites1. Originally released as a blogging platform in 2003, WordPress has evolved to support a variety of web sites: from media galleries to online stores and everything in between.

WordPress has became a jack of all trades on the internet. With almost 60,000 plugins and over 10,000 themes to choose from – WordPress can do just about anything. What is common between TechCrunch, The New York Times, and Bloomberg? They all use WordPress.

Since I started developing web sites in 2009, I’ve worked with a wide variety of content management systems. Despite my curiosity in other platforms – I keep coming back to WordPress. It’s just that good.

Benefits of WordPress

WordPress is really easy to set up and configure. A simple project can take only a few hours to get up and running. Most hosting providers support WordPress. Some have 1-click installation and offer hosting plans designed specifically for WordPress. Some examples are:

EasyWP

$ 13 .00

By NameCheap

  • Installed in under 90 seconds
  • 99.9% Uptime
  • 3X faster than traditional hosting
View

WP Hosting

$ 36 .00

By bluehost

  • Free Domain for one year
  • 1-click WordPress installation
  • Free SSL certificate
View

Extensive theme variety typically makes customization a relatively simple task. A good theme will be responsive and compatible with a wide variety of devices (hence mobile friendly) out of the box. Designing a web site from scratch, on the other hand, will (typically) require significantly more time than customizing WordPress to meet your needs. A good theme will cost you around $60 (one time) to purchase. There are plenty of free themes available as well. Two good places to start looking for a theme are:

WordPress plugins are lifesavers: there is a plug in for just about anything that a small business may need on their web site. From live chats and analytics to email campaigns and forms, most are pretty easy to set up and maintain. Plugins range wildly in price depending on your specific needs. You can begin exploring plugins here:

Most important benefit for a small business, is that in majority of use cases, you will not need to touch code or manage your own server. Instead you will be able to focus on managing your core business.

Cost breakdown

An approximate cost breakdown will look something like this:

One-page
low traffic
2-5 Pages
medium traffic
25+ pages
high traffic
Initial set up$100+$350+$1000+
Hosting$30 / Year$80 / Year$150 / Year
Domain Name
(with SSL)
$25 / Year$25 / Year$25 / Year
Theme$60$60$60
Plugins$10 / Year$50 / Year$350 / Year
Maintenance Cost$30 / month$70 / Month$250 / Month
*Assuming that you hire a developer to help you with initial set up and monthly maintenance.

Overall costs can vary greatly depending on your project. Things like logos, content and search engine optimization are not factored into the price estimate because they are not specific to WordPress. Ideally you will provide your developer with logos, text and have a plan for search engine optimization.

You can do it yourself

Considering the popularity of WordPress, there are a lot of tutorials and information. Anyone that is willing to invest a few days into learning WordPress can set up their own web site without learning how to code. This can save your a lot of money in exchange for your time.

An alternative is to hire someone to set WordPress up to your liking and then to learn how to manage your own WordPress instance after initial installation. Luckily, most tedious tasks (like updates and backups) can be automated but you will still have to check on your site from time to time to ensure that it is running smoothly.

If you are going to add recurring content to your web site (for example weekly blog posts), you should definitely learn how to use WordPress user interface. The good news is that it is not any more difficult than using Microsoft Office products.

Drawbacks of WordPress

WordPress does require some upkeep: periodic updates to the core code, theme, and plugins will be needed. Luckily this can be automated, for the most part. Unfortunately things can break during updates and some troubleshooting may be required.

What this means for you is added overhead. For a small business use case, you should budget at least one hour of maintenance time per month for these unexpected issues.

Scaling WordPress is not an easy (or cheap) task. Luckily this is not a concern for most small businesses that do not see high traffic. Additionally, managed WordPress hosting plans can significantly improve your sites performance if you end up seeing high traffic and slowdowns.

Ultimately these challenges are not unique to WordPress but they are worth considering against your specific use case.

Reasons WordPress may not be for you

  • You want a static web site with no blog or fancy features
  • Speed is your number 1 priority
  • Security is your number 1 priority

TL;DR

WordPress is the “Swiss Army Knife” of content management systems. It’s a powerful tool that powers a large chunk of existing internet. WordPress is user friendly, fast to spin up, and easy to manage. I have found it to be the most cost effective way to run a web site in 2022 and I keep coming back to WordPress despite trying out other content management systems.

References
  1. Usage statistics and market share of WordPress, May 2022. https://w3techs.com/technologies/details/cm-wordpress
Read MoreWhy choose WordPress for a small business web site in 2022

My First Encounter with Handshake Domains

With 19,185 blockchains listed on CoinMarketCap and crypto related scams appearing in the news almost daily, it is easy to dismiss an interesting project. As an avid web 2.0 user and developer, I have been mostly ignoring “revolutionary” web 3.0 claims.

The other night I was browsing my favorite domain name registrar when I came across a mysterious “HNS button”. I hovered and the following message appeared: “Handshake domains are here!”. My curiosity got the best of me, so I started my research and ended up really liking this project.

Handshake is a single purpose blockchain that explores ways to compliment existing Domain Network System (DNS). In order to understand my interest in Handshake, we should first talk about our current DNS system.

Why do we need DNS?

Computers talk numbers. Humans talk natural language. DNS is a bridge to translate language into numbers. When you ask your browser to go to hdomain.info, your computer will ask a DNS server to translate that domain name into Internet Protocol (IP) address. This IP address is how your computer going to know how to reach the domain that you’ve requested.

Who controls existing DNS?

Current DNS is a decentralized protocol designed to run on many servers all over the world. This decentralization does converge to 13 root name servers operated by 12 independent root zone operators. (source) Internet Corporation for Assigned Names and Numbers (ICANN) is a nonprofit organization that oversees the operation of root name servers and delegates top-level domain (TLD) operations to various organizations. For example, .com is owned by Verisign and I am merely renting `romantaylor` second level domain (SLD) from them. In other words when you “buy” your SLD, you’re actually renting it for a period of 1 to 10 years.

second level domain vs top level domain

Our current DNS system is relatively centralized despite running on a decentralized protocol. Is it a bad thing? Not necessarily but HNS has the potential to make existing DNS even better.

What is Handshake (HNS)?

Handshake is a decentralized naming protocol where anyone can participate in managing root domain naming zone. Handshake is not trying to replace DNS. Instead Handshake is an experimental project that is exploring ways to compliment the existing system by enabling regular people to own and manage top level domain names among other features.

You can think of HNS blockchain as a distributed root zone file where anyone can participate in managing this file.

Can HNS and existing DNS coexist?

Yes. HNS does not aim to replace existing DNS. It is meant to replace (currently semi-centralized) root zone file. As a result HNS must co-exist in our current namespace. In order to accomplish this compatibility, following steps were taken by HNS developers:

  • Existing Top Level Domain Names are reserved (meaning you can’t bid on com/ or edu/)
  • Approximately 90,000 existing domain names are also reserved. These were selected based on Alexa.com top web site rankings. (See HNS FAQ for more info)

I view this compatibility as a huge plus and it is one of the reasons I really like this project. web 3.0 projects that play nice with existing infrastructure are my cup of tea because web 3.0 is unproven and is not ready for prime time while web 2.0 is just too convenient and well executed. Perhaps there is room for web 2.5 with projects like Handshake.

HNS is awesome

Because it is cool to be able to own your personal TLD instead of renting an SLD. It’s a low cost (and low risk) way for anyone to enter the wild west of decentralized internet.

Currently there are three ways to try it out (that I know of):

  1. The easiest way is to use Namebase. They also have a lot of useful information about Handshake blockchain that will help you get started.
  2. If you have some experience with crypto and prefer to manage your own keys, you can try BobWallet.
  3. Lastly, you could spin up a full node and manage your wallet using command line.

TL;DR

Handshake is by far my favorite decentralized web project at this time. It is not attempting to replace an existing DNS system. Instead it is trying to compliment it. Existing DNS already runs on a decentralized protocol so this is not a revolutionary idea… It’s a cool one because now you can own a top level domain instead of renting a second level domain.

Read MoreMy First Encounter with Handshake Domains

Junior Software Engineer Resume

One of the most critical parts of finding a job (especially in this virtual environment) is your resume. Yet this is something that’s commonly overlooked in traditional school curriculum. A simple search will reveal a mountain of general resume information but you will rarely come across advice specific to junior developers and new grads seeking employment in software industry.

cartoon resumes

My experience: over the years I’ve applied to countless jobs and internships as a junior Software Engineer. Throughout that process I paid careful attention to my resume performance. Also I got feedback from engineers involved in the hiring process and listened carefully when HR offered resume tips. 

Let me share what I’ve learned:

Formatting – it’s a big deal

Your resume should be one page and one page only (Letter/A4 8.5×11 inches page). Pretty much no exceptions here for junior engineers. Only include things that are significant for this role. You would not be applying for an entry level position (or an internship) if you had 2 pages worth of applicable experience. 

Styling is not how you’re going to stand out: Keep it simple. Mostly monotone. Keep it consistent. All titles should look the same, front sizes should be consistent. Capitalization should be uniform. Bad punctuation will make you look bad. 

Dates are very important. Include them and be consistent. 

Stick to consistent format when describing your projects and work experience. For instance, if you start with a company name in your first job description – do the same for all job experiences. 

Punctuation, capitalization, and spelling are also important. Make sure you spell check your work and get as many eyes on your resume as possible before finalizing the wording. 

Did I mention consistency?

Your Resume Header

Provide your first and last legal name top and center of your resume. Make it bold. If you have a nickname, include it in parenthesis following your first name. You can include a desired role below your name if you want. This is not a requirement and may help your recruiter but should only be used when you have plenty of extra space to spare.

Below your name, include your email and phone. Ensure your email is professional – no gamergal@bzzt.net – and matches your email used in your job application. I encourage you to include your LinkedIn, portfolio, and GitHub links. Make your links clickable and don’t make your recruiter look you up (because they will!).

Lastly, you may optionally include your location but do not include your full address. Just include your city and state. This part will be appreciated by a recruiter but can be omitted to save space.

Education Section

Include following details: university name, degree/program/major/minor, academic honors (if applicable), location, GPA (if above 3.0), and graduation date. 

You may list applicable courses if you have extra space to fill. 

Work Experience Section

This section may include internships, freelancing, and really-large projects. List company name, position title, role description is optional and only helpful if your job title is confusing. Include dates (Month, Year – Month, Year) and location (City, State).

Let’s make your bullets stand out!

You should have 3 to five bullet points for each work experience. Each bullet point should focus on describing what you did, why you did it, and what the impact of that action was. Details are important and including specific name brands may be useful.

Let’s look at some examples:

  1. Not great: Looked at crash test data and generated reports
  2. A bit better: Analyzed crash test data points utilizing Splunk
  3. Much better: Analyzed critical crash test data – utilizing Splunk – to improve safety; added 1 start NTSH rating of Model T via Python magic

Which version of a bullet point would you prefer to read if you were hiring?

Should I mention this..? if you’re listing it on your resume – be prepared to speak about it in depth during your interview. 

Cover letter and LinkedIn

Cover letter is optional depending on the situation. Definitely include a cover letter if you’re switching careers or applying for a role that’s not easily applicable to your experience. Ensure that your cover letter includes key words related directly to the job you’re applying for. That will trigger the applicant tracking system to highlight your cover letter resulting in a higher chance of a recruiter actually reading it. I will write another post focusing on cover letters soon.

Definitely include your LinkedIn link (as a hyperlink). Think of your LinkedIn as your extended resume. 

The only way to save your resume

Save your file as PDF. This is a must unless you want your resume to look different on someone else’s machine.

Include your full name in the file name resume_roman_taylor.pdf. This helps recruiters on the back-end.

TL;DR aka Primary Takeaways

  • One page in length
  • Stay consistent
  • Spell check
  • Save as PDF
Read MoreJunior Software Engineer Resume

Scheme Interpreter Written in Python

(+ python scheme)

Introduction:

Python 3 based interpreter for the Scheme programming language. Scheme is a simple but powerful functional programming language. It is statically scoped and a properly tail recursive dialect of the Lisp programming language1. The supported Scheme scope of this interpreter closely resembles the R5RS version of Scheme but does not completely follow defined functionality.

Try me on Replit

Implementation:

Interpreting expressions required evaluation of terms like nil and simple types like numbers and strings to then print them back to the user. The next step is to evaluate expressions like (+ 2 2). In Scheme, simple expressions have the following form (operator operand1 operand2). The idea is to parse operator and operands between matching sets of parentheses. What about more complex/nested expressions like (+ (* 2 2) 2)? In order to parse nested expressions, recursion is applied to matching parentheses until we complete the evaluation.

Other features like conditionals (e.g. (and [test 1] [test 2] ...)) were then implemented to further support complex functions along with operands which support multiple statements (e.g. (begin (statement 1) (statement 2))).

Finally lambdas and named lambdas (i.e. functions) were implemented to support looping — remember that Scheme does not have loop functionality — using recursion in combination with the above expressions and operands to create a flexible functional language.

Try this:

Basics:

Python 3Scheme
x = 7(define x 7)
y = x + 3(define y (+ x 3))
"return this" if y > 1 else "we will not return this"(if (> y 1) "return this" "we will not return this")

Fibonacci number:

Let’s generate the Fibonacci sequence2 up to x:

$ (define (fib x) (if (<= x 2) 1 (+ (fib (- x 1)) (fib (- x 2)))))
$ (define (runfib x) (if (<= x 0) 0 (begin (print (fib x)) (runfib (- x 1))))) 

Create a list:

$ (define list_x (cons “string 1” (cons “string 2” nil)))
$ list_x
$ (“string 1” “string 2”)

References:

  1. R5RS Scheme Summary [Web Page]. https://schemers.org/Documents/Standards/R5RS/HTML/
  2. Multiple Editors (2021). Fibonacci number. Wikipedia. https://en.wikipedia.org/wiki/Fibonacci_number
Read MoreScheme Interpreter Written in Python

End-to-end Encryption for Cloud Storage System

Introduction

Consider a group of users (Alice and Bob) who want to share documents among themselves while keeping them secret from adversaries (one of which is Eve) who have complete access to the system on which the documents were shared (think of a Google Doc that Google can not read). By leveraging cryptographic protocols and primitives such as Public Key Encryption, Hashing, and Message Authentication Codes to protect the identities of the users and protect the integrity of the documents – the sharing system and the documents shared can be kept secret from unauthorized users.

Cloud Storage System Diagram

The first problem to be solved is in sharing the documents

If Alice shares a document with Bob, Eve is allowed to intercept that share. Eve can also modify it. Bob must be able to detect any tampering done to the shared document prior to reading it. Also if Eve intercepts the share, she should obtain no information about the location of the document within the system. This means that file metadata (such as the date, title, and author) should be encrypted and only visible to Bob. When Bob receives the share, Bob now has the location of the document, the name of the document, and the privilege to share this document with others. This creates a tree-like sharing structure where Alice is allowed to revoke privilege to Bob which in turn revokes privilege to anyone with whom Bob shared the document.

A system to revoke privilege to documents is in place to keep previously trusted users and the users with whom they shared the documents from reading any additions to the documents unless they are authorized. By leveraging a combination of cryptographic primitives, Alice can revoke access to a document shared with Bob. Even if Bob shared the document with Kayla and Max, the newly appended information can’t be read by either Bob, Kayla or Max while leaving the sharing structure intact for other privileged users like Michael to read and write to the document. 

What about editing shared documents?

To add flexibility to the system, appending to files has been implemented without overwriting previously written data. This decreases the amount of work necessary to append to documents, keeps the on-disk files holding the documents with many additions small, and hides the size of files from adversaries. Cryptographic primitives like Message Authentication Codes and Public Key Encryption were leveraged to maintain the confidentiality and integrity of all pieces of the documents for all privileged users.

Project details

Unfortunately I am unable to publicly post implementation details or link to a repository. This project was implemented in GoLang and I would be happy to discuss specific details over a coffee. Please reach out if you want to learn more.

Contact me
Read MoreEnd-to-end Encryption for Cloud Storage System

Volumetric Cloud Simulation

Abstract

Combine tessellating Worley and smooth noise patterns with Beer’s Law and the Henyey-Greenstein phase function to model ray-tracing through cloud formations of varying densities, sample rates, and light properties.

Technical approach

Clouds have a characteristic shape in the popular imagination. One approach to generating the cloud is using a combination of 3D Worley noise and smooth noise. Combined in three dimensions – those noises result in cloud like appearance. Texture is then passed to an OpenGL shader for ray tracing and ray marching. Stripped down version of Project 4: Cloth Simulator code was used as a starting point.

Generating Cloud Textures

The process starts with seeding a bounding box with numerous random points (known as Worley points), then calculating the closest distance to the nearest Worley point for every pixel. It’s helpful to reduce the computational demand by dividing the bounding box into a grid of nine cells and only adding one Worley point to each cell. This process limits the number of “nearest point” calculations for each pixel to just 8 in 2D, and 26 in 3D. Having the distance from each pixel to the nearest Worley point provides the framework for generating the overlapping circular shape of a cloud’s edges, but in order to create seamless cloud textures that don’t abruptly end if the camera position changes, the Worley point formation is “wrapped”. This is done by duplicating the bounding box (grid cells and Worley points included) until the original is surrounded (by 8 clones in 2D space, and 26 in 3D space), then using adjacent Worley points in the clones in the nearest point calculation.

Red dots: Worley Noise
White dots: Cell boundaries
Red Dots: Worley Noise
White Dots: Density
Worley Noise

Worley noise provides decent outlines for the clouds, but is rather lacking when it comes to texture. To populate Worley cloud scaffolds, Perlin noise (which is a type of gradient noise often used for textures) can be helpful. Smooth noise is another option. After trying both, smooth noise was chosen for this project. In 2D, the smooth noise generation process involves trilinear filtering on every pixel. Extending the technique to 3D space was a design choice made to make the clouds appear more realistic.

Then, Worley and smooth noise was combined using the scale function described in Fredrik Haggstrom’s “Real-time rendering of volumetric clouds” thesis.

Raytracing

At this point, a cloud-looking texture is passed into the shader. Inside the shader, texture is placed in a rectangular shape. At first my team tried outputting the texture on the surface of the rectangle. This resulted in a following output (image on the left below):

Texture displayed on the Surface

Wrong Implementation

Texture displayed inside the box (“quad”)

Correct implementation

A better approach to this problem is to use a quad implementation (image on the right above). The idea is to shoot a ray from the camera at the quad intersecting the texture container. For each ray that intersects the texture – sample that texture with an adjustable sample_rate. Calculate the output pixel output onto the quad using the Beer’s law5. This method properly draws the clouds onto the scene and enables manipulation of the cloud placement, cloud size, and point of view.

Raymarching

Next step was to add light to the clouds. In order to do this, as the ray pierces through the texture: for each sample point, another ray is shot towards the light source, adding up the light landing at every texture point between the light source and sample point. This gives an overall light estimation for every sample point on the ray. Combining light for every sample point gives the total light output for that pixel on the quad. 

The Henyey-Greenstein equation is useful in adjusting the light angle falling on our cloud. Additionally my team placed a variety of scalar adjustments in graphical user interface to help with troubleshooting and dialing in the settings.

At this point the clouds were starting look really good and required only minor tweaks.

Performance and compatibility note

OpenGL has been depreciated by MacOS. Many of the OpenGL functions that would enable quicker texture generation via GPUs are only found in the latest versions of OpenGL. To maintain compatibility with Apple devices, compute shaders were not used. All of the texture generation is done on the CPU. OpenMP was used to parallelize parts of the process which is still significantly slower than compared to a computer shader.

Contributions and special mentions

This project is a fork of my original work6 in Computer Graphics course at University of California, Berkeley (UCB). I would like to extend special thank you to my team and UCB Computer Science Department staff who made this project possible and fun.

In the Spring of 2021, my team & this project was selected as the top showcase winner out of almost 70 teams competing against us7.

Results

This project achieved my teams original goal to render volumetric clouds adjustable in size and placement. Additionally the GUI enables variety of additional adjustments — such as light location, sample rate, and scale — in real time. Lastly, the point of view is also adjustable.

Example 1: Below the clouds with a star texture backdrop
Example 2: Above & through the clouds with gradient backdrop

References

  1. Olajos, Rikard. (2016). Real-Time Rendering of Volumetric Clouds [Master’s thesis, Lund University]. ISSN 1650-2884 LU-CS-EX 2016-42. https://lup.lub.lu.se/luur/download?func=downloadFile&recordOId=8893256&fileOId=8893258
  2. Häggström, Fredrik. (2018). Real-time rendering of volumetric clouds [Master’s thesis, Umeå Universitet]. https://www.diva-portal.org/smash/get/diva2:1223894/FULLTEXT01.pdf
  3. Lague, S. [Sebastian Lague] (2019, October 7). Coding Adventure: Clouds [Video file]. YouTube. https://www.youtube.com/watch?v=4QOcCGI6xOU
  4. Vandevenne, L. (2004). Lode’s Computer Graphics Tutorial. Texture Generation using Random Noise. https://lodev.org/cgtutor/randomnoise.html
  5. Multiple Editors (2021). Beer-Lambert Law. Wikipedia. https://en.wikipedia.org/wiki/Beer%E2%80%93Lambert_law
  6. Zachary Y, Roman T, Callam I, William D (2021). Cloud Renderer Project. https://184clouds.xyz/
  7. Course Staff (2021). CS184/284A Final Project Showcase. UC Berkeley course web site. https://cs184.eecs.berkeley.edu/sp21/docs/final_showcase

Read MoreVolumetric Cloud Simulation