Normal-Heights crate

I've put together a small crate to produce normal maps from height maps. The repo is here:

I did have the idea of pulling in rayon to speed things up, but just compiling with release seems sufficiently fast for the image sizes I'm working with, so adding parallelism is a low priority for me at the moment.

But especially as this is my first published crate, feedback is welcome.

1 Like

Hi, congrats on your first crate! :slight_smile: Since this operates on images, it would probably nice to have some visual illustration in the README, e.g. some height map and the normal map generated from it. If this is for a game, maybe a screenshot of that as well.

1 Like

Thanks for the feedback! I've added some sample height and normal maps and pushed them out to GitHub. I'm going to hold off on updating for now.

I am planning to use this in a tool to make content for a game, but said tool still needs to be made and said game is made by someone else. But I'm also not sure screenshots of the tool I'm envisioning would be particularly useful included with this crate, though.

1 Like

nice touch with the synthetic image on the one hand and the world map on the other!

1 Like

Try running cargo clippy, you still have some improvements that you can make! You should also have tests just for sanity check.

1 Like

Clippy's lints aren't very helpful here in my opinion.

While I would in general agree with the many single character names being bad, I think it's justified here. x and y are the standard names for these coordinates and while the n, s, e, and w could be expanded out to their full names, I thing that would be more distracting than helpful. The tight layout better conveys the meaning in my opinion.

As for the absurd comparison lint, I don't find the reasoning behind it very compelling for the u32 <= 0 case. I prefer the more defensive style.

But I did add an #[allow()] for those two lints to that function. And I do appreciate the reminder that clippy exists. I've got a bad habit of not thinking about it.

As for tests, yes I do need to add some.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.