Codification
Instead of a message of two blocks I suggest one of five separated by a common pattern that is never used anywhere else in the message. It could just be decided after the rest of the message. In this answer I'll assume "010101".
Preamble
The first block would be a patter that would be very unlikely to happen in nature, to increase the probability of being detected without complicated analysis. My ignorant guess would be "010101000001010011100101110111010101" which at first may seem just irregular, but if split in groups of three is the delimiter 010101 followed by 000 001 010 011 100 101 110 111 followed by an other delimiter. I proposed this as I never heard of a star counting in binary. And counting is usually associated with intelligence. It would be a message that there are actually intelligent creatures there. Not to mention that it would set the bitrate frequency for the rest of the message.
Multi-valued intensity
From here on I suggest using different veils that are able to let though different amounts of light (For example by making them smaller or with some holes). This may allow you to use less material for some veils and also to shorten the message. For example if their star is particularly bright they could use 8 different levels and codify three bits in one veil. This is a particularly basic way of codifying signals and it would be made clear by the second block.
The second block contains a rising scale of the different possible intensities repeated two times. Two times to make sure the instant of start and the end of the scale are not mistaken with the delimiter. The delimiter is codified in normal binary and never in the compressed way.
I also want to point out that this codification and the delimiter are basic patterns that would surely be known by any culture with a basic knowledge of information theory. They are like one of the first strategies we developed to store information and send signals.
Math
This block is made by a big image containing various things. The first row has the opposite value of the background and the next one is empty. This both to make sure they get the size of the image and to ease the understanding of it being an image (They'd just need to break the lines at the same point of the first one and they'd see the image).
The upper part of the image is used to show some mathematical symbols. In particular it's possible to use sticks for numbers and some small combination of pixels for the symbol. In the next part the numbers are codified in sticks and any letter is a symbol. For example "1 2 3 1A1B2 2A3B5 3A3B1A5 2C3B6 D2EB2 D1A1EC3B6 XB10" could be used to define addition, multiplication, parenthesis and the symbol X to be the same as 10. More symbols and example should be added as necessary. In particular a better way to represent numbers is essential, but it's done in the same way.
Branch of physics.
To represent the branch of physics I suggest using an image like the previews block, just filled with equations, images or numeric examples of the equations with relative image to show the branch of physics.
For example you you could use some drawing of different atoms with next to them three numbers with two fixed symbol in the middle. For example 1F1 with hydrogen, 2F4 with helium, 1F2 for deuterium and 1F1G1F1 for a molecular hydrogen. Then you could use simple chemical equations like "1F2 + 1F2 = 4 * 2F4" which with our conventions is "D+D = 4He", an approximation of the nuclear fusion equation "D + D → 4He* + 24 MeV".
Danger
As per the danger I'd use multiple examples represented in an image. The first is an pair of drawings, the ones suggested by OP in a comment: A pair of images of the solar system, one with and one without our planet.
Then I'd use a similar structure of my example on nuclear fusion to represent a couple of chemical equations. One could be of a highly corrosive substance like HF (Hydrogen fluoride). If HF is not considered to be enough, we could use Fluoroantimonic acid, which can only be stored in teflon due to its exceptional corrosiveness (which I assume to mean that it corrodes practically anything else and is thus dangerous to any kind of alien and their buildings).
Additional we could use and other things like represent spontaneous explosive reactions to show that we are talking about a more generic thing. Explosives simply because they create damage and while different materials are able to withstand different amount of energies, I doubt that there are civilizations with the assumed knowledge of physics without have ever experienced an explosion.
Other relevant things
About images
One potential problem is that images need eyes to be seen and we can't be sure an aliens can see them.
In case this message is received by a race that can't see, I think they would still be able to perceive this as a surface. The point is if their technology has output interfaces braille-style that can be used for this task.
I think that they would: a 2D interface would be so much better to use then a 1D one in so many applications. For example if one wants to use a microscopes, consider something about the positions of the stars or to see the result of an experiment with a particle collider. I'm not saying you can't do all those things with sounds, it's just much easier with a 2D interface.
Number of veils
If we leave out the content of the last two blocks then we have a bare minimum of 209 veils, with the following assumptions:
- background with high luminosity (no veil)
- the material used by a veil is proportional to the amount of light they block
- we have 8 levels of luminosity
- math has 5 symbols +*=() and we use the example sequence.
- formulas written rotated 90° clockwise.
- a bigger delimiter of 7 veils that is probably enough for any content.
And if we codify the math symbols in this way. 1 for each row separated by an empty line. Each equation have 4 empty lines above and below. X is low luminosity.
... ... ...
.XX XXX XXX 1 2+3/7
... ... ...
... ..X .X. B= 3/7
... ... ...
... ..X ..X A+ 2/7
... ... ...
... ..X .XX D( 4/7
... ... ...
... .XX ..X E) 4/7
... ... ...
... .XX .X. C* 5/7
... ... ...
The 209 veils can be broken down in this way:
- 42 = 7*6 for the delimiters.
- 12 for first block.
- 8 = 4*2 for 2° block.
- 3 = 9/3 for the first row of first image.
- 136 = (2+3/7)*56 for each stick of the 3° block.
- 8 = 5*2/7 + 6*3/7 + 2*5/7 + 2*4/7 + 2*4/7 to explain math symbols
If the danger message was nuclear fusion, then an estimation of the additional size would be two times that (additional two for reactions, their syntax, -1 and 0). I'd guess an helium atom is way smaller than a recognizable solar system in somewhat right proportions. Therefore I think that the two images of with/without earth are the most heavy ones.
Recap
The message is a set of five blocks, the first two to detect and decode the message. Same for the third that represent how to decode those equations. The remaining two form the actual message: one contains things related to a certain field of knowledge while the other contains dangerous things and images of bad events.
EDIT:
- reshuffling and minor improvements.
- improved Branch of physics
- added veil count.
- fixed/improved danger section.
- removed part about SI constants as I made a wrong assumption.