tabvaranjr

tabvaranjr

Hands-on Rust: Rendering issues with entities

Hi there! I’ve finished the book last Friday. Good work! It’s a very good introduction to Rust and I really enjoyed it.

I have noticed that some entities are rendering incorrectly. Take a good look at the sprites at page 254 and compare them with the sprites at pages 98 and 99 (beta 5 of the book). For instance, the potion lacks liquid and the scroll lacks its ribbon. I can reproduce this issue in Fedora Linux and Windows 10.

I’m pretty new to Rust but I’m quite experienced with OpenGL so I took a look at your shaders.

Here’s a magnified frame where you can clearly see the issue. You can also notice that orcs are missing their legs and their shadows.

Here’s the fragment shader used to render the tiles of the BTermBuilder::with_simple_console_no_bg() console:

The selected line is the interesting part.

Here’s a sample of the sprite texture:

I’ve sampled a texel of the potion at the right (see “Pixel Context”; the texel is the one within the square) and its RGBA value is in the red box, below the player and the letter A (pardon my lack of skills with GIMP). As you can see in the blue box, the G value is lower than 0.1, so the fragment shader discards the whole fragment. Here’s our problem.

Simply removing the selected line in the fragment shader fixes the issue. Yay!

However, you also have to adjust the terminal8x8.png font map and set the alpha of the black pixels to 0. Otherwise, you’ll get a black screen. I’ve uploaded my modified map in my repo.

Now, I can send you a PR for bracket-terminal but I’m not quite sure of the side effects for other programs than the ones in the book. I mean, this line was probably there for a reason.

Cheers!

Popular Pragmatic Bookshelf topics Top

edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
JohnS
I can’t setup the Rails source code. This happens in a working directory containing multiple (postgres) Rails apps. With: ruby-3.0.0 s...
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex> product = %Product{} %Pento....
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
digitalbias
Title: Build a Weather Station with Elixir and Nerves: Problem connecting to Postgres with Grafana on (page 64) If you follow the defau...
New
Charles
In general, the book isn’t yet updated for Phoenix version 1.6. On page 18 of the book, the authors indicate that an auto generated of ro...
New
New
s2k
Hi all, currently I wonder how the Tailwind colours work (or don’t work). For example, in app/views/layouts/application.html.erb I have...
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New

Other popular topics Top

New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
PragmaticBookshelf
Author Spotlight Jamis Buck @jamis This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New

Latest in Hands-on Rust

Hands-on Rust Portal