text:
# Relative species abundance

Relative species abundance is a component of biodiversity and refers to how common or rare a species is relative to other species in a defined location or community.[1] Relative abundance is the percent composition of an organism of a particular kind relative to the total number of organisms in the area.[2] Relative species abundances tend to conform to specific patterns that are among the best-known and most-studied patterns in macroecology. Different populations in a community exist in relative proportions and this idea is called as relative abundance.

## Introduction

### Relative species abundance

Figure 1. Relative species abundance of beetles sampled from the river Thames showing the universal "hollow curve". (derived from data presented in Magurran (2004)[3] and collected by C.B. Williams (1964)[4])

Relative species abundance and species richness describe key elements of biodiversity.[1] Relative species abundance refers to how common or rare a species is relative to other species in a given location or community.[1][5]

Usually relative species abundances are described for a single trophic level. Because such species occupy the same trophic level they will potentially or actually compete for similar resources.[1] For example, relative species abundances might describe all terrestrial birds in a forest community or all planktonic copepods in a particular marine environment.

Relative species abundances follow very similar patterns over a wide range of ecological communities. When plotted as a histogram of the number of species represented by 1, 2, 3, ..., n individuals usually fit a hollow curve, such that most species are rare, (represented by a single individual in a community sample) and relatively few species are abundant (represented by a large number of individuals in a community sample)(Figure 1).[5] This pattern has been long-recognized and can be broadly summarized with the statement that "most species are rare".[6] For example, Charles Darwin noted in 1859 in The Origin of Species that "... rarity is the attribute of vast numbers of species in all classes...."[7]

Species abundance patterns can be best visualized in the form of relative abundance distribution plots. The consistency of relative species abundance patterns suggests that some common macroecological "rule" or process determines the distribution of individuals among species within a trophic level.

### Distribution plots

Figure 2. Preston plot of beetles sampled from the river Thames showing a strong right-skew.[3][4]
Figure 3. Whittaker plot of beetles sampled from the river Thames showing a slight "s"-shape.[3][4]

Relative species abundance distributions are usually graphed as frequency histograms ("Preston plots"; Figure 2)[8] or rank-abundance diagrams ("Whittaker Plots"; Figure 3).[9]

Frequency histogram (Preston plot):

x-axis: logarithm of abundance bins (historically log2 as a rough approximation to the natural logarithm)
y-axis: number of species at given abundance

Rank-abundance diagram (Whittaker plot):

x-axis: species list, ranked in order of descending abundance (i.e. from common to rare)
y-axis: logarithm of % relative abundance

When plotted in these ways, relative species abundances from wildly different data sets show similar patterns: frequency histograms tend to be right-skewed (e.g. Figure 2) and rank-abundance diagrams tend to conform to the curves illustrated in Figure 4.

## Understanding relative species abundance patterns

Researchers attempting to understand relative species abundance patterns usually approach them in a descriptive or mechanistic way. Using a descriptive approach biologists attempt to fit a mathematical model to real data sets and infer the underlying biological principles at work from the model parameters. By contrast, mechanistic approaches create a mathematical model based on biological principles and then test how well these models fit real data sets.[10]

### Descriptive approaches

#### Geometric series (Motomura 1932)

Figure 4. Generic Rank-abundance diagram of three common mathematical models used to fit species abundance distributions: Motomura's geometric series, Fisher's logseries, and Preston's log-normal series (modified from Magurran 1988)[11]
Figure 5. Plant succession in abandoned fields within Brookhaven National Laboratory, NY. Species abundances conform to the geometric series during early succession but approach lognormal as the community ages. (modified from Whittaker 1972[12])

I. Motomura developed the geometric series model based on benthic community data in a lake.[13] Within the geometric series each species' level of abundance is a sequential, constant proportion (k) of the total number of individuals in the community. Thus if k is 0.5, the most common species would represent half of individuals in the community (50%), the second most common species would represent half of the remaining half (25%), the third, half of the remaining quarter (12.5%) and so forth.

Although Motomura originally developed the model as a statistical (descriptive) means to plot observed abundances, the "discovery" of his paper by Western researchers in 1965 led to the model being used as a niche apportionment model – the "niche-preemption model".[9] In a mechanistic model k represents the proportion of the resource base acquired by a given species.

The geometric series rank-abundance diagram is linear with a slope of –k, and reflects a rapid decrease in species abundances by rank (Figure 4).[13] The geometric series does not explicitly assume that species colonize an area sequentially, however, the model fits the concept of niche preemption, where species sequentially colonize a region and the first species to arrive receives the majority of resources.[14] The geometric series model fits observed species abundances in highly uneven communities with low diversity.[14] This is expected to occur in terrestrial plant communities (as these assemblages often show strong dominance) as well as communities at early successional stages and those in harsh or isolated environments (Figure 5).[9]

#### Logseries (Fisher et al 1943)

${\displaystyle S=\alpha \ln {\left(1+{N \over {\alpha \,\!}}\right)}}$

where:

S = the number of species in the sampled community
N = the number of individuals sampled
${\displaystyle \alpha \,\!}$ = a constant derived from the sample data set

The logseries was developed by Ronald Fisher to fit two different abundance data sets: British moth species (collected by Carrington Williams) and Malaya butterflies (collected by Alexander Steven Corbet).[15] The logic behind the derivation of the logseries is varied[16] however Fisher proposed that sampled species abundances would follow a negative binomial from which the zero abundance class (species too rare to be sampled) was eliminated.[1] He also assumed that the total number of species in a community was infinite. Together, this produced the logseries distribution (Figure 4). The logseries predicts the number of species at different levels of abundance (n individuals) with the formula:

${\displaystyle S_{n}={\alpha \,\!x^{n} \over n}}$

where:

S = the number of species with an abundance of n
x = a positive constant (0 < x < 1) which is derived from the sample data set and generally approaches 1 in value

The number of species with 1, 2, 3, ..., n individuals are therefore:

${\displaystyle \alpha ,{\alpha \,\!x^{2} \over {2}},{\alpha \,\!x^{3} \over {3}},\dots ,{\alpha \,\!x^{n} \over {n}}}$
##### Fisher’s constants
Ronald Fisher

The constants α and x can be estimated through iteration from a given species data set using the values S and N.[3] Fisher's dimensionless α is often used as a measure of biodiversity, and indeed has recently been found to represent the fundamental biodiversity parameter θ from neutral theory (see below).

#### Log normal (Preston 1948)

Figure 6. An example of Preston's veil. Fish species abundances sampled using repeated trawling over a one-month (blue bars), two month (gold bars) and one-year period (yellow). One year of sampling indicates that the fish community is log-normally distributed. (derived from Magurran 2004[3])

Using several data sets (including breeding bird surveys from New York and Pennsylvania and moth collections from Maine, Alberta and Saskatchewan) Frank W. Preston (1948) argued that species abundances (when binned logarithmically in a Preston plot) follow a Normal (Gaussian) distribution, partly as a result of the Central Limit Theorem (Figure 4).[8] This means that the abundance distribution is Lognormal. According to his argument, the right-skew observed in species abundance frequency histograms (including those described by Fisher et al. (1943)[15]) was, in fact, a sampling artifact. Given that species toward the left side of the x-axis are increasingly rare, they may be missed in a random species sample. As the sample size increases however, the likelihood of collecting rare species in a way that accurately represents their abundance also increases, and more of the normal distribution becomes visible.[8] The point at which rare species cease to be sampled has been termed Preston's veil line. As the sample size increases Preston's veil is pushed farther to the left and more of the normal curve becomes visible[3][11](Figure 6). Williams' moth data, originally used by Fisher to develop the logseries distribution, became increasingly lognormal as more years of sampling were completed.[1][4]

##### Calculating theoretical species richness

Preston's theory has an application: if a community is truly lognormal yet under-sampled, the lognormal distribution can be used to estimate the true species richness of a community. Assuming the shape of the total distribution can be confidently predicted from the collected data, the normal curve can be fit via statistical software or by completing the Gaussian formula:[8]

${\displaystyle n=n_{0}e^{-(aR)^{2}}\,}$

where:

n0 is the number of species in the modal bin (the peak of the curve)
n is the number of species in bins R distant from the modal bin
a is a constant derived from the data

It is then possible to predict how many species are in the community by calculating the total area under the curve (N):

${\displaystyle N={n_{0}{\sqrt {\pi }} \over a}}$

The number of species missing from the data set (the missing area to the left of the veil line) is simply N minus the number of species sampled.[3] Preston did this for two lepidopteran data sets, predicting that, even after 22 years of collection, only 72% and 88% of the species present had been sampled.[8]

#### Yule model (Nee 2003)

The Yule model is based on a much earlier, Galton–Watson model which was used to describe the distribution of species among genera.[17] The Yule model assumes random branching of species trees, with each species (branch tip) having the equivalent probability of giving rise to new species or becoming extinct. As the number of species within a genus, within a clade, has a similar distribution to the number of individuals within a species, within a community (i.e. the "hollow curve"), Sean Nee (2003) used the model to describe relative species abundances.[5][18] In many ways this model is similar to niche apportionment models, however, Nee intentionally did not propose a biological mechanism for the model behavior, arguing that any distribution can be produced by a variety of mechanisms.[18]

### Mechanistic approaches: niche apportionment

Note: This section provides a general summary of niche apportionment theory, more information can be found under niche apportionment models.

Most mechanistic approaches to species abundance distributions use niche-space, i.e. available resources, as the mechanism driving abundances. If species in the same trophic level consume the same resources (such as nutrients or sunlight in plant communities, prey in carnivore communities, nesting locations or food in bird communities) and these resources are limited, how the resource "pie" is divided among species determines how many individuals of each species can exist in the community. Species with access to lots of resources will have higher carrying capacities than those with little access. Mutsunori Tokeshi[19] later elaborated niche apportionment theory to include niche filling in unexploited resource space.[10] Thus, a species may survive in the community by carving out a portion of another species' niche (slicing up the pie into smaller pieces) or by moving into a vacant niche (essentially making the pie larger, for example, by being the first to arrive in a newly available location or through the development of a novel trait that allows access previously unavailable resources). Numerous niche apportionment models have been developed. Each make different assumptions about how species carve up niche-space.

#### Unified neutral theory (Hubbell 1979/2001)

The Unified Neutral Theory of Biodiversity and Biogeography (UNTB) is a special form of mechanistic model that takes an entirely different approach to community composition than the niche apportionment models.[1] Instead of species populations reaching equilibrium within a community, the UNTB model is dynamic, allowing for continuing changes in relative species abundances through drift.

A community in the UNTB model can be best visualized as a grid with a certain number of spaces, each occupied with individuals of different species. The model is zero-sum as there are a limited number of spaces that can be occupied: an increase in the number of individuals of one species in the grid must result in corresponding decrease in the number of individuals of other species in the grid. The model then uses birth, death, immigration, extinction and speciation to modify community composition over time.

Hubbell's theta

The UNTB model produces a dimensionless "fundamental biodiversity" number, θ, which is derived using the formula:

θ = 2Jmv

where:

Jm is the size of the metacommunity (the outside source of immigrants to the local community)
v is the speciation rate in the model

Relative species abundances in the UNTB model follow a zero-sum multinomial distribution.[20] The shape of this distribution is a function of the immigration rate, the size of the sampled community (grid), and θ.[20] When the value of θ is small, the relative species abundance distribution is similar to the geometric series (high dominance). As θ gets larger, the distribution becomes increasingly s-shaped (log-normal) and, as it approaches infinity, the curve becomes flat (the community has infinite diversity and species abundances of one). Finally, when θ = 0 the community described consists of only one species (extreme dominance).[1]

##### Fisher's alpha and Hubbell's theta – an interesting convergence

An unexpected result of the UNTB is that at very large sample sizes, predicted relative species abundance curves describe the metacommunity and become identical to Fisher's logseries. At this point θ also becomes identical to Fisher's ${\displaystyle \alpha \,\!}$ for the equivalent distribution and Fisher's constant x is equal to the ratio of birthrate : deathrate. Thus, the UNTB unintentionally offers a mechanistic explanation of the logseries 50 years after Fisher first developed his descriptive model.[1]

## References

1. Hubbell, S. P. 2001. The unified neutral theory of biodiversity and biogeography. Princeton University Press, Princeton, N.J.
2. ^ Angelo Mark P. Walag,; Mae Oljae P. Canencia (2016). "Physico-chemical Parameters and Macrobenthic Invertebrates of the Intertidal Zone of Gusa, Cagayan de Oro City, Philippines". Advances in Environmental Sciences - International Journal of the Bioflux Society. 8 (1): 71–82. Retrieved 2015-10-27.
3. Magurran, A. E. 2004. Measuring biological diversity. Blackwell Scientific, Oxford.
4. ^ a b c d Williams, C.B. 1964. Patterns in the balance of nature and related problems in quantitative ecology. Academic Press, London.
5. ^ a b c McGill, B. J., Etienne R. S., Gray J. S., Alonso D., Anderson M. J., Benecha H. K., Dornelas M., Enquist B. J., Green J. L., He F., Hurlbert A. H., Magurran A. E., Marquet P. A., Maurer B. A., Ostling A., Soykan C. U., Ugland K. I., White E. P. 2007. "Species abundance distributions: moving beyond single prediction theories to integration within an ecological framework". Ecology Letters 10: 995–1015
6. ^ Andrewartha, H. G.; Birch L. C. 1954. The Distribution and Abundance of Animals. The University of Chicago Press, Chicago, Illinois.
7. ^ Darwin, C. 2004 (1859). The Origin of Species by means of natural selection or the preservation of favoured races in the struggle for life. Castle Books, New Jersey.
8. Preston, F. W. (1948). "The Commonness, and Rarity, of Species" (PDF). Ecology. 29 (3): 254–283. doi:10.2307/1930989.
9. ^ a b c Whittaker, R. H. 1965. "Dominance and diversity in land plant communities", Science 147: 250–260
10. ^ a b Tokeshi, M. 1999. Species coexistence: ecological and evolutionary perspectives. Blackwell Scientific, Oxford
11. ^ a b Magurran, A. E. 1988. Ecological Diversity and Its Measurement. Princeton Univ. Press
12. ^ Whittaker, R. H. 1972. "Evolution and measurement of species diversity". Taxon 21:213–251
13. ^ a b Motomura, I. 1932. "A statistical treatment of associations", Japanese Journal of Zoology. 44: 379–383 (in Japanese)
14. ^ a b He , F., Tang D. 2008. "Estimating the niche preemption parameter of the geometric series" Acta Oecologica 33 (1):105–107
15. ^ a b Fisher, R. A; Corbet, A. S.; Williams, C. B. 1943. "The relation between the number of species and the number of individuals in a random sample of an animal population". Journal of Animal Ecology 12: 42–58.
16. ^ Johnson, J. L.; Adrienne, W. K.; Kotz, S. (2005). Univariate and Discrete Distributions, 3rd edn. John Wiley and Sons, New York
17. ^ Yule, G. U. 1924. "A mathematical theory of evolution based on the conclusions of Dr. J. C. Willis, FRS". Philosophical Transactions of the Royal Society B 213: 21–87
18. ^ a b Nee, S. 2003. "The unified phenomenological theory of biodiversity". In T. Blackburn and K. Gaston, editors, Macroecology: concepts and consequences. Blackwell Scientific, Oxford.
19. ^ Tokeshi, M. 1990. "Niche apportionment or random assortment: species abundance patterns revisited". Journal of Animal Ecology 59: 1129–1146
20. ^ a b Hubbell, S. P.; Lake J. 2003. "The neutral theory of biogeography and biodiversity: and beyond". In T. Blackburn and K. Gaston, editors, Macroecology: concepts and consequences. Blackwell Scientific, Oxford.


text:
## Monday, 29 December 2014

### comprehending comprehensions

One of the features of Python I really like, and am using more and more, is its list comprehension.  This allows the items in a list to be manipulated as a whole, rather than having to explicitly iterate over them.

The basic form of a list comprehension is
[ expr for item in list ]

where expr is an expression in the variable item.

For example, let’s say I have heard that the term x3x, where x is an integer, is always divisible by 3.  Before trying to prove (or disprove!) this, I want to have a quick look at a few examples to check there isn’t a really simple counter-example.  I can write:
>>> [ x * x * x - x for x in range(-4,10) ]
[-60, -24, -6, 0, 0, 0, 6, 24, 60, 120, 210, 336, 504, 720]
Well, that looks plausible, but maybe my mental arithmetic isn’t too hot, and I need confirmation that all those numbers really are divisible by 3.

A list comprehension has an optional condition, returning only the (expression of) the items where the condition is true.
[ expr for item in list if cond ]
A few of the integers not divisible by 3 are:
>>> [ x for x in range(-4,10) if x%3 != 0 ]
[-4, -2, -1, 1, 2, 4, 5, 7, 8]
Are any of the cubic expressions not divisible by 3?
>>> [ x for x in range(-4,10) if (x * x * x - x)%3 != 0 ]
[]
Okay, so it’s probably worth having a shot at the proof then.

Of course, comprehensions aren’t limited to lists of numbers.  Let’s say I have a list of strings, and want to get a list of the lengths of the long strings (more than 5 characters long, say).
>>> animals = [ 'cat', 'dog', 'horse', 'elephant', 'meerkat', 'ox']
>>> [ len(s) for s in animals ]
[3, 3, 5, 8, 7, 2]
>>> [ s for s in animals if 5 < len(s) ]
['elephant', 'meerkat']
>>> [ len(s) for s in animals if 5 < len(s) ]
[8, 7]

List comprehensions can be applied to nested lists, too. I might have a list of lists, let’s say a list of a list of animal and of planets (why not?).
>>> planets = [ 'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto']
>>> big_list = [ animals, planets ]
>>> big_list
[['cat', 'dog', 'horse', 'elephant', 'ox'], ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto']]
(I’m sorry, but as far as I’m concerned, Pluto is indeed a planet.)

I can get a list of the lengths of all the long strings:
>>>[ s for lst in big_list for s in lst ]
['cat', 'dog', 'horse', 'elephant', 'meerkat', 'ox', 'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto']
>>>[ len(s) for lst in big_list for s in lst ]
[3, 3, 5, 8, 7, 2, 7, 5, 5, 4, 7, 6, 6, 7, 5]
>>>[ len(s) for lst in big_list for s in lst if 5 < len(s) ]
[8, 7, 7, 7, 6, 6, 7]
This way, I can process the nested lists as one big flattened list.

But what if I didn’t want to flatten the list?  Well, since list comprehensions are themselves expressions, they can form the expression in a list comprehension!  Used this way, they maintain the structure of the original nesting.  So
>>>[ [s for s in lst] for lst in big_list ]
[['cat', 'dog', 'horse', 'elephant', 'meerkat', 'ox'], ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto']]
>>>[ [len(s) for s in lst] for lst in big_list ]
[[3, 3, 5, 8, 7, 2], [7, 5, 5, 4, 7, 6, 6, 7, 5]]
>>>[ [len(s) for s in lst if 5 < len(s)] for lst in big_list ]
[[8, 7], [7, 7, 6, 6, 7]]
This approach becomes even more powerful when the list items are objects, and we need to operate on object attribute values.  Let’s assume that the list items above are not strings, but objects with a name attribute that is the relevant string.
>>>[ [s.name for s in lst if 5 < len(s.name)] for lst in big_list ]
[['elephant', 'meerkat'], ['Mercury', 'Jupiter', 'Saturn', 'Uranus', 'Neptune']]
When using a list comprehension as an expression inside another comprehension in this way, we don’t need to have it as the top level expression.  Let’s assume that we want a list of numpy arrays of the lengths (maybe because we want to do numpy operations on the resulting lists, such as averaging the results).
>>> from numpy import *
>>>[ array([len(s.name) for s in lst if 5 < len(s.name)]) for lst in big_list ]
[array([8, 7]), array([7, 7, 6, 6, 7])]

List comprehensions are powerful, removing the need for explicit for loops that iterate over the list items.  This results in more compact, and efficient, code, and encourages thinking of lists as a whole.  Take care that the compact code remains comprehensible, however, especially with nested comprehensions.

And there are dictionary comprehensions, too.

format: plain


text:
# C++ Export Visual Studio shader compile custom build rules to a text file

## Recommended Posts

Example custom build tool command for a shader which has vertex, pixel, and geometry shader stages:

fxc %(Identity) /E VSMain /T vs_5_0 $(HLSLCompileFlags) /Fo %(Identity)\..\Binary\%(Filename).vert.bin fxc %(Identity) /E PSMain /T ps_5_0$(HLSLCompileFlags) /Fo %(Identity)\..\Binary\%(Filename).frag.bin
fxc %(Identity) /E GSMain /T gs_5_0 \$(HLSLCompileFlags) /Fo %(Identity)\..\Binary\%(Filename).geom.bin

So here is the process-

- Run custom build rules for the shader files

- In post-build event of the project, collect all these custom build tool commands and dump them to a text file

- Now if user wants to recompile, just load this text file and execute all commands inside

How would I get access to these custom build tool commands in the post-build event?

Edited by mark_braga

##### Share on other sites

If your normal build process in Visual Studio invokes MSBuild (by default it should), then look in the options for the output verbosity (Tools/Options/Projects and Solutions/Build and Run/MSBuild project build output verbosity) and crank it all the way up (Diagnostic).  Then do whatever you normally do which invokes the custom tool and see if the command line options for the tool show up in the build output window.

In VS2017 I also see an option to do that for a build log file.  You could potentially write a command line tool which parses the log file, then run that tool for your 'when a user presses a key' case.

I've only used this for UWP packaging automation, but it might work in your case as well.

Edited by Nypyren

##### Share on other sites

Thats a good idea. But does it crank up the verbosity only on my local machine or it is actually changing project settings?

Edit:

The .tlog folder has all the custom build commands stored in the custombuild.command.1.tlog file. This makes it straightforward.

Thanks for the help

Edited by mark_braga

##### Share on other sites

I think it changes it for your local user settings, so the change won't affect other people on the team.  That could be good or bad depending on whether you want everyone to use the whole verbose-logging process or if you plan to distribute the resulting log after you capture it.

Edited by Nypyren

## Create an account

Register a new account

• 9
• 9
• 13
• 41
• 15
• ### Similar Content

• bs::framework is a newly released, free and open-source C++ game development framework. It aims to provide a modern C++14 API & codebase, focus on high-end technologies comparable to commercial engine offerings and a highly optimized core capable of running demanding projects. Additionally it aims to offer a clean, simple architecture with lightweight implementations that allow the framework to be easily enhanced with new features and therefore be ready for future growth.
Some of the currently available features include a physically based renderer based on Vulkan, DirectX and OpenGL, unified shading language, systems for animation, audio, GUI, physics, scripting, heavily multi-threaded core, full API documentation + user manuals, support for Windows, Linux and macOS and more.
The next few updates are focusing on adding support for scripting languages like C#, Python and Lua, further enhancing the rendering fidelity and adding sub-systems for particle and terrain rendering.
A complete editor based on the framework is also in development, currently available in pre-alpha stage.

View full story

• bs::framework is a newly released, free and open-source C++ game development framework. It aims to provide a modern C++14 API & codebase, focus on high-end technologies comparable to commercial engine offerings and a highly optimized core capable of running demanding projects. Additionally it aims to offer a clean, simple architecture with lightweight implementations that allow the framework to be easily enhanced with new features and therefore be ready for future growth.
Some of the currently available features include a physically based renderer based on Vulkan, DirectX and OpenGL, unified shading language, systems for animation, audio, GUI, physics, scripting, heavily multi-threaded core, full API documentation + user manuals, support for Windows, Linux and macOS and more.
The next few updates are focusing on adding support for scripting languages like C#, Python and Lua, further enhancing the rendering fidelity and adding sub-systems for particle and terrain rendering.
A complete editor based on the framework is also in development, currently available in pre-alpha stage.

• Hi again,  After some looking around I have decided to base my game directly on Direct X rather than using an existing game engine.  Because of the nature of the stuff I'm doing it just didn't seem to fit very well and I kept running into road blocks.  At this point I have a big blob of code for doing fractal world generation and some collision code,  and I'm trying to put it into some form that resembles a game engine.  Since I've never used one before It's a bit alien to me ..... so can someone direct me to a book, website, article, whatever... that covers this?  I'm mainly looking for stuff that covers C++ library design. I'm not adverse to using 3rd party tools for stuff I can used them for.

• I'M interested in programming tools (For animation, UI, etc). Can anyone suggest me the resources where I can start learning or which technologies I need achive it.

Thanks,
Rakshit
• By chiffre
Introduction:
In general my questions pertain to the differences between floating- and fixed-point data. Additionally I would like to understand when it can be advantageous to prefer fixed-point representation over floating-point representation in the context of vertex data and how the hardware deals with the different data-types. I believe I should be able to reduce the amount of data (bytes) necessary per vertex by choosing the most opportune representations for my vertex attributes. Thanks ahead of time if you, the reader, are considering the effort of reading this and helping me.
I found an old topic that shows this is possible in principal, but I am not sure I understand what the pitfalls are when using fixed-point representation and whether there are any hardware-based performance advantages/disadvantages.
(TLDR at bottom)
The Actual Post:
To my understanding HLSL/D3D11 offers not just the traditional floating point model in half-,single-, and double-precision, but also the fixed-point model in form of signed/unsigned normalized integers in 8-,10-,16-,24-, and 32-bit variants. Both models offer a finite sequence of "grid-points". The obvious difference between the two models is that the fixed-point model offers a constant spacing between values in the normalized range of [0,1] or [-1,1], while the floating point model allows for smaller "deltas" as you get closer to 0, and larger "deltas" the further you are away from 0.
To add some context, let me define a struct as an example:
struct VertexData { float[3] position; //3x32-bits float[2] texCoord; //2x32-bits float[3] normals; //3x32-bits } //Total of 32 bytes Every vertex gets a position, a coordinate on my texture, and a normal to do some light calculations. In this case we have 8x32=256bits per vertex. Since the texture coordinates lie in the interval [0,1] and the normal vector components are in the interval [-1,1] it would seem useful to use normalized representation as suggested in the topic linked at the top of the post. The texture coordinates might as well be represented in a fixed-point model, because it seems most useful to be able to sample the texture in a uniform manner, as the pixels don't get any "denser" as we get closer to 0. In other words the "delta" does not need to become any smaller as the texture coordinates approach (0,0). A similar argument can be made for the normal-vector, as a normal vector should be normalized anyway, and we want as many points as possible on the sphere around (0,0,0) with a radius of 1, and we don't care about precision around the origin. Even if we have large textures such as 4k by 4k (or the maximum allowed by D3D11, 16k by 16k) we only need as many grid-points on one axis, as there are pixels on one axis. An unsigned normalized 14 bit integer would be ideal, but because it is both unsupported and impractical, we will stick to an unsigned normalized 16 bit integer. The same type should take care of the normal vector coordinates, and might even be a bit overkill.
struct VertexData { float[3] position; //3x32-bits uint16_t[2] texCoord; //2x16bits uint16_t[3] normals; //3x16bits } //Total of 22 bytes Seems like a good start, and we might even be able to take it further, but before we pursue that path, here is my first question: can the GPU even work with the data in this format, or is all I have accomplished minimizing CPU-side RAM usage? Does the GPU have to convert the texture coordinates back to a floating-point model when I hand them over to the sampler in my pixel shader? I have looked up the data types for HLSL and I am not sure I even comprehend how to declare the vertex input type in HLSL. Would the following work?
struct VertexInputType { float3 pos; //this one is obvious unorm half2 tex; //half corresponds to a 16-bit float, so I assume this is wrong, but this the only 16-bit type I found on the linked MSDN site snorm half3 normal; //same as above } I assume this is possible somehow, as I have found input element formats such as: DXGI_FORMAT_R16G16B16A16_SNORM and DXGI_FORMAT_R16G16B16A16_UNORM (also available with a different number of components, as well as different component lengths). I might have to avoid 3-component vectors because there is no 3-component 16-bit input element format, but that is the least of my worries. The next question would be: what happens with my normals if I try to do lighting calculations with them in such a normalized-fixed-point format? Is there no issue as long as I take care not to mix floating- and fixed-point data? Or would that work as well? In general this gives rise to the question: how does the GPU handle fixed-point arithmetic? Is it the same as integer-arithmetic, and/or is it faster/slower than floating-point arithmetic?
Assuming that we still have a valid and useful VertexData format, how far could I take this while remaining on the sensible side of what could be called optimization? Theoretically I could use the an input element format such as DXGI_FORMAT_R10G10B10A2_UNORM to pack my normal coordinates into a 10-bit fixed-point format, and my verticies (in object space) might even be representable in a 16-bit unsigned normalized fixed-point format. That way I could end up with something like the following struct:
struct VertexData { uint16_t[3] pos; //3x16bits uint16_t[2] texCoord; //2x16bits uint32_t packedNormals; //10+10+10+2bits } //Total of 14 bytes Could I use a vertex structure like this without too much performance-loss on the GPU-side? If the GPU has to execute some sort of unpacking algorithm in the background I might as well let it be. In the end I have a functioning deferred renderer, but I would like to reduce the memory footprint of the huge amount of vertecies involved in rendering my landscape.
TLDR: I have a lot of vertices that I need to render and I want to reduce the RAM-usage without introducing crazy compression/decompression algorithms to the CPU or GPU. I am hoping to find a solution by involving fixed-point data-types, but I am not exactly sure how how that would work.


text:
BREAKING NEWS
Helix angle

## Summary

Helix Angle[clarification needed]

In mechanical engineering, a helix angle is the angle between any helix and an axial line on its right, circular cylinder or cone.[1] Common applications are screws, helical gears, and worm gears.

The helix angle references the axis of the cylinder, distinguishing it from the lead angle, which references a line perpendicular to the axis. Naturally, the helix angle is the geometric complement of the lead angle. The helix angle is measured in degrees.

## Concept

In terms specific to screws, the helix angle can be found by unraveling the helix from the screw, representing the section as a right triangle, and calculating the angle that is formed. Note that while the terminology directly refers to screws, these concepts are analogous to most mechanical applications of the helix angle.

The helix angle can be expressed as:[2]

${\displaystyle {\mbox{Helix angle}}=\arctan \left({\frac {2\pi r_{m}}{L}}\right)}$

where

l is lead of the screw or gear

## Applications

The helix angle is crucial in mechanical engineering applications that involve power transfer and motion conversion. Some examples are outlined below, though its use is much more widely spread.

### Screw

A plot of the efficiency of a screw versus the thread helix angle.

Cutting a single helical groove into a screw-stock cylinder yields what is referred to as a single-thread screw. Similarly, one may construct a double-thread screw provided that the helix angle is the same, and a second thread is cut in the space between the grooves of the first. For certain applications, triple and quadruple threads are in use.[3] The helix may be cut either right hand or left hand. In screws especially, the helix angle is essential for calculating torque in power screw applications.

The maximum efficiency for a screw is defined by the following equations:[4]

${\displaystyle \alpha =45^{o}-{\frac {\phi }{2}}}$
${\displaystyle \eta _{max}={\frac {1-\sin {\phi }}{1+\sin {\phi }}}}$

Where ${\displaystyle \alpha \,}$ is the helix angle, ${\displaystyle \phi \,}$ is the friction angle, and ${\displaystyle \eta _{max}}$ is the maximum efficiency. The friction value is dependent on the materials of the screw and interacting nut, but ultimately the efficiency is controlled by the helix angle. The efficiency can be plotted versus the helix angle for a constant friction, as shown in the adjacent diagram. The maximum efficiency is a helix angle between 40 and 45 degrees, however a reasonable efficiency is achieved above 15°. Due to difficulties in forming the thread, helix angle greater than 30° are rarely used. Moreover, above 30° the friction angle becomes smaller than the helix angle and the nut is no longer self-locking and the mechanical advantage disappears.[4]

### Helical gear

Helical and worm handedness

In helical and worm gears, the helix angle denotes the standard pitch circle unless otherwise specified.[1] Application of the helix angle typically employs a magnitude ranging from 15° to 30° for helical gears, with 45° capping the safe operation limit. The angle itself may be cut with either a right-hand or left-hand orientation.[5] In its typical parallel arrangement, meshing helical gears requires that the helix angles are of the same magnitude and cut oppositely .

### Worm gear

Worm gears resemble helical gear seats, the difference being that the shafts of a worm train are aligned perpendicularly. In this case, the helix angle of the worm meshes with the lead angle of the worm gear.[6]

## References

1. ^ a b Gear Nomenclature, Definition of Terms with Symbols, American Gear Manufacturers Association, p. 72, ISBN 1-55589-846-7, OCLC 65562739, ANSI/AGMA 1012-G05
2. ^ Shigley, p. 401.
3. ^ Norton, Robert L., Machine Design: An Integrated Approach. 3rd ed. Upper Saddle River, NJ: Pearson Prentice Hall, 2006.
4. ^ a b Karwa, p. 252.
5. ^ Shigley, Joseph E., and Larry D. Mitchell Mechanical Engineering Design. 4th ed. New York: McGraw-Hill, Inc, 1983.
6. ^ Spotts, M F., and T E. Shoup. Design of Machine Elements. 7th ed. Upper Saddle River, NJ: Prentice Hall, 1998.

### Bibliography

• Bhandari, V B (2007), Design of Machine Elements, Tata McGraw-Hill, ISBN 978-0-07-061141-2.
• Karwa, Rajendra (2005), A textbook of machine design, Firewall Media, ISBN 978-81-7008-833-2.